android Programming Glossary: super.ondraw
Android WebView renders blank/white, view doesn't update on css changes or HTML changes, animations are choppy http://stackoverflow.com/questions/13500452/android-webview-renders-blank-white-view-doesnt-update-on-css-changes-or-html context @Override protected void onDraw Canvas canvas super.onDraw canvas Warning This will cause the WebView to continuously be..
How to maintain multi layers of ImageViews and keep their aspect ratio based on the largest one? http://stackoverflow.com/questions/16729169/how-to-maintain-multi-layers-of-imageviews-and-keep-their-aspect-ratio-based-on @Override protected void onDraw Canvas canvas super.onDraw canvas Matrix matrix getImageMatrix if matrix null int numLayers..
How should I give images rounded corners in Android? http://stackoverflow.com/questions/1705239/how-should-i-give-images-rounded-corners-in-android
Rotating a view in android http://stackoverflow.com/questions/1930963/rotating-a-view-in-android
Android - Way to appear bordered text on the TextView? http://stackoverflow.com/questions/2026873/android-way-to-appear-bordered-text-on-the-textview context @Override protected void onDraw Canvas canvas super.onDraw canvas Rect rect new Rect Paint paint new Paint paint.setStyle..
android ellipsize multiline textview http://stackoverflow.com/questions/2160619/android-ellipsize-multiline-textview canvas if isStale super.setEllipsize null resetText super.onDraw canvas private void resetText int maxLines getMaxLines String..
Custom ImageView with drop shadow http://stackoverflow.com/questions/3693234/custom-imageview-with-drop-shadow Rect r mRect Paint paint mPaint canvas.drawRect r paint super.onDraw canvas @Override protected void onMeasure int w int h super.onMeasure..
Trying to get the display size of an image in an ImageView http://stackoverflow.com/questions/3855218/trying-to-get-the-display-size-of-an-image-in-an-imageview defStyle @Override protected void onDraw Canvas canvas super.onDraw canvas int test this.getWidth int test2 this.getHeight @Override..
Touch and drag image in android http://stackoverflow.com/questions/4255859/touch-and-drag-image-in-android true @Override protected void onDraw Canvas canvas super.onDraw canvas bitmap BitmapFactory.decodeResource getResources R.drawable.ball_green..
creating a system overlay (always on top) button in android http://stackoverflow.com/questions/4481226/creating-a-system-overlay-always-on-top-button-in-android 255 255 0 0 @Override protected void onDraw Canvas canvas super.onDraw canvas canvas.drawText Hello World 5 15 mLoadPaint @Override..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c @Override public boolean onTouchEvent MotionEvent event if..
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas Y initialY @Override public void onDraw Canvas canvas super.onDraw canvas Draw background. canvas.drawBitmap bgr 0 0 null Compute.. return true @Override public void onDraw Canvas canvas super.onDraw canvas Draw scrolling background. Rect fromRect1 new Rect 0..
Pinch zoom for custom view http://stackoverflow.com/questions/5216658/pinch-zoom-for-custom-view ev return true @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save canvas.scale mScaleFactor mScaleFactor .....
Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch return true @Override public void onDraw Canvas canvas super.onDraw canvas draw background canvas.drawBitmap bgr 0 0 null copy..
Horizontal scrolling grid view http://stackoverflow.com/questions/5725745/horizontal-scrolling-grid-view color @Override public void onDraw Canvas canvas super.onDraw canvas this.setBackgroundColor Color.LTGRAY Paint paint new..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events return true @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save Log.d DEBUG X mPosX Y mPosY canvas.translate..
Modifying the Android seekbar widget to operate vertically http://stackoverflow.com/questions/631238/modifying-the-android-seekbar-widget-to-operate-vertically void onDraw Canvas c c.rotate 90 c.translate 0 29 super.onDraw c public boolean onTouchEvent MotionEvent event xPos event.getX.. void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c private OnSeekBarChangeListener onChangeListener @Override..
Android imageView Zoom-in and Zoom-Out http://stackoverflow.com/questions/6650398/android-imageview-zoom-in-and-zoom-out void onDraw Canvas canvas TODO Auto generated method stub super.onDraw canvas here u can control the width and height of the images..........
Android WebView renders blank/white, view doesn't update on css changes or HTML changes, animations are choppy http://stackoverflow.com/questions/13500452/android-webview-renders-blank-white-view-doesnt-update-on-css-changes-or-html String TAG MyWebView public MyWebView Context context super context @Override protected void onDraw Canvas canvas super.onDraw canvas Warning This will cause the WebView to continuously be redrawn and will drain the devices battery while the view..
How to maintain multi layers of ImageViews and keep their aspect ratio based on the largest one? http://stackoverflow.com/questions/16729169/how-to-maintain-multi-layers-of-imageviews-and-keep-their-aspect-ratio-based-on or setImageResource throw new RuntimeException detailMessage @Override protected void onDraw Canvas canvas super.onDraw canvas Matrix matrix getImageMatrix if matrix null int numLayers mLayers.size boolean pendingAnimations false for int..
How should I give images rounded corners in Android? http://stackoverflow.com/questions/1705239/how-should-i-give-images-rounded-corners-in-android
Rotating a view in android http://stackoverflow.com/questions/1930963/rotating-a-view-in-android
Android - Way to appear bordered text on the TextView? http://stackoverflow.com/questions/2026873/android-way-to-appear-bordered-text-on-the-textview super context attrs public MyTextView Context context super context @Override protected void onDraw Canvas canvas super.onDraw canvas Rect rect new Rect Paint paint new Paint paint.setStyle Paint.Style.STROKE paint.setColor Color.WHITE paint.setStrokeWidth..
android ellipsize multiline textview http://stackoverflow.com/questions/2160619/android-ellipsize-multiline-textview isStale true @Override protected void onDraw Canvas canvas if isStale super.setEllipsize null resetText super.onDraw canvas private void resetText int maxLines getMaxLines String workingText fullText boolean ellipsized false if maxLines..
Custom ImageView with drop shadow http://stackoverflow.com/questions/3693234/custom-imageview-with-drop-shadow 1f Color.BLACK @Override protected void onDraw Canvas canvas Rect r mRect Paint paint mPaint canvas.drawRect r paint super.onDraw canvas @Override protected void onMeasure int w int h super.onMeasure w h int mH mW mW getSuggestedMinimumWidth getMeasuredWidth..
Trying to get the display size of an image in an ImageView http://stackoverflow.com/questions/3855218/trying-to-get-the-display-size-of-an-image-in-an-imageview context AttributeSet attrs int defStyle super context attrs defStyle @Override protected void onDraw Canvas canvas super.onDraw canvas int test this.getWidth int test2 this.getHeight @Override protected void onSizeChanged int w int h int oldw int oldh..
Touch and drag image in android http://stackoverflow.com/questions/4255859/touch-and-drag-image-in-android MyThread getHolder this getHolder .addCallback this setFocusable true @Override protected void onDraw Canvas canvas super.onDraw canvas bitmap BitmapFactory.decodeResource getResources R.drawable.ball_green canvas.drawColor Color.BLUE To make background..
creating a system overlay (always on top) button in android http://stackoverflow.com/questions/4481226/creating-a-system-overlay-always-on-top-button-in-android true mLoadPaint.setTextSize 10 mLoadPaint.setARGB 255 255 0 0 @Override protected void onDraw Canvas canvas super.onDraw canvas canvas.drawText Hello World 5 15 mLoadPaint @Override protected void onLayout boolean arg0 int arg1 int arg2 int..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android getMeasuredHeight getMeasuredWidth protected void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c @Override public boolean onTouchEvent MotionEvent event if isEnabled return false switch event.getAction case MotionEvent.ACTION_DOWN..
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas int screenW 2 ballW 2 Centre ball into the centre of the screen. Y initialY @Override public void onDraw Canvas canvas super.onDraw canvas Draw background. canvas.drawBitmap bgr 0 0 null Compute roughly ball speed and location. Y int dY Increase or decrease.. case MotionEvent.ACTION_UP ballFingerMove false dY 0 break return true @Override public void onDraw Canvas canvas super.onDraw canvas Draw scrolling background. Rect fromRect1 new Rect 0 0 bgrW bgrScroll bgrH Rect toRect1 new Rect bgrScroll 0 bgrW..
Pinch zoom for custom view http://stackoverflow.com/questions/5216658/pinch-zoom-for-custom-view inspect all events. mScaleDetector.onTouchEvent ev return true @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save canvas.scale mScaleFactor mScaleFactor ... Your onDraw code ... canvas.restore private class ScaleListener..
Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch invalidate break case MotionEvent.ACTION_UP break return true @Override public void onDraw Canvas canvas super.onDraw canvas draw background canvas.drawBitmap bgr 0 0 null copy the default overlay into temporary overlay and punch a hole..
Horizontal scrolling grid view http://stackoverflow.com/questions/5725745/horizontal-scrolling-grid-view context int color super context this.context context this.color color @Override public void onDraw Canvas canvas super.onDraw canvas this.setBackgroundColor Color.LTGRAY Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setColor color canvas.drawCircle..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events mActivePointerId ev.getPointerId newPointerIndex break return true @Override public void onDraw Canvas canvas super.onDraw canvas canvas.save Log.d DEBUG X mPosX Y mPosY canvas.translate mPosX mPosY canvas.scale mScaleFactor mScaleFactor mImage.draw..
Modifying the Android seekbar widget to operate vertically http://stackoverflow.com/questions/631238/modifying-the-android-seekbar-widget-to-operate-vertically changed l t r b left l right r top t bottom b protected void onDraw Canvas c c.rotate 90 c.translate 0 29 super.onDraw c public boolean onTouchEvent MotionEvent event xPos event.getX yPos event.getY float progress yPos this.getTop this.getBottom.. getMeasuredHeight getMeasuredWidth protected void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c private OnSeekBarChangeListener onChangeListener @Override public void setOnSeekBarChangeListener OnSeekBarChangeListener..
Android imageView Zoom-in and Zoom-Out http://stackoverflow.com/questions/6650398/android-imageview-zoom-in-and-zoom-out R.drawable.icon setFocusable true @Override protected void onDraw Canvas canvas TODO Auto generated method stub super.onDraw canvas here u can control the width and height of the images........ this line is very important image.setBounds getWidth..
|