| android Programming Glossary: invalidateHow 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    return super.verifyDrawable dr @Override public void invalidateDrawable Drawable dr if verifyDrawable dr  invalidate else super.invalidateDrawable.. void invalidateDrawable Drawable dr if verifyDrawable dr  invalidate else super.invalidateDrawable dr  @Override public Resources.. Drawable dr if verifyDrawable dr  invalidate else super.invalidateDrawable dr  @Override public Resources getResources return mResources.. 
 ListView item background via custom selector http://stackoverflow.com/questions/2562051/listview-item-background-via-custom-selector  to the same resource have two states so the drawable will invalidate itself when coming out of pressed state. item android state_focused.. 
 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  custom view only one frame is drawn at the time until next invalidate is called which means that you have to draw your animation frame.. that it looks like ball has rotated. Call the next frame. invalidate  This is just a simple illustration but I would use surfaceView.. 
 Auto Scale TextView Text to Fit within Bounds http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds  mult mSpacingAdd add  Set the upper text size limit and invalidate the view @param maxTextSize public void setMaxTextSize float.. float maxTextSize mMaxTextSize maxTextSize requestLayout invalidate  Return upper text size limit @return public float getMaxTextSize.. return mMaxTextSize  Set the lower text size limit and invalidate the view @param minTextSize public void setMinTextSize float.. 
 Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch  MotionEvent.ACTION_DOWN  X int ev.getX  Y int ev.getY  invalidate  break   case MotionEvent.ACTION_MOVE  X int ev.getX  Y int.. MotionEvent.ACTION_MOVE  X int ev.getX  Y int ev.getY  invalidate  break    case MotionEvent.ACTION_UP  break  return true  @Override.. 
 Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events   final float dy y mLastTouchY  mPosX dx  mPosY dy  invalidate  mLastTouchX x mLastTouchY y break  case MotionEvent.ACTION_UP.. 
 Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger  point.x event.getX point.y event.getY points.add point invalidate Log.d TAG point point return true return super.onTouchEvent.. 
 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  i  Layer layer mLayers.get i if layer.drawable dr  return true   return super.verifyDrawable dr @Override public void invalidateDrawable Drawable dr if verifyDrawable dr  invalidate else super.invalidateDrawable dr  @Override public Resources getResources.. true   return super.verifyDrawable dr @Override public void invalidateDrawable Drawable dr if verifyDrawable dr  invalidate else super.invalidateDrawable dr  @Override public Resources getResources return mResources @Override public void setImageBitmap.. dr @Override public void invalidateDrawable Drawable dr if verifyDrawable dr  invalidate else super.invalidateDrawable dr  @Override public Resources getResources return mResources @Override public void setImageBitmap Bitmap bm throws.. 
 ListView item background via custom selector http://stackoverflow.com/questions/2562051/listview-item-background-via-custom-selector  @drawable list_item_gradient Even though these two point to the same resource have two states so the drawable will invalidate itself when coming out of pressed state. item android state_focused true android state_enabled false android state_pressed.. 
 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  either part of a View or linked to a bitmap. In onDraw in a custom view only one frame is drawn at the time until next invalidate is called which means that you have to draw your animation frame by frame. Here is an example of bouncing ball which rotates.. the rotated canvas. canvas.restore Rotate the canvas back so that it looks like ball has rotated. Call the next frame. invalidate  This is just a simple illustration but I would use surfaceView and drive frames from another thread which is a bit more.. 
 Auto Scale TextView Text to Fit within Bounds http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds  add float mult super.setLineSpacing add mult mSpacingMult mult mSpacingAdd add  Set the upper text size limit and invalidate the view @param maxTextSize public void setMaxTextSize float maxTextSize mMaxTextSize maxTextSize requestLayout invalidate.. the view @param maxTextSize public void setMaxTextSize float maxTextSize mMaxTextSize maxTextSize requestLayout invalidate  Return upper text size limit @return public float getMaxTextSize return mMaxTextSize  Set the lower text size limit and.. upper text size limit @return public float getMaxTextSize return mMaxTextSize  Set the lower text size limit and invalidate the view @param minTextSize public void setMinTextSize float minTextSize mMinTextSize minTextSize requestLayout invalidate.. 
 Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch  boolean onTouchEvent MotionEvent ev  switch ev.getAction  case MotionEvent.ACTION_DOWN  X int ev.getX  Y int ev.getY  invalidate  break   case MotionEvent.ACTION_MOVE  X int ev.getX  Y int ev.getY  invalidate  break    case MotionEvent.ACTION_UP  break..  X int ev.getX  Y int ev.getY  invalidate  break   case MotionEvent.ACTION_MOVE  X int ev.getX  Y int ev.getY  invalidate  break    case MotionEvent.ACTION_UP  break  return true  @Override public void onDraw Canvas canvas super.onDraw canvas.. 
 Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events  if mScaleDetector.isInProgress  final float dx x mLastTouchX  final float dy y mLastTouchY  mPosX dx  mPosY dy  invalidate  mLastTouchX x mLastTouchY y break  case MotionEvent.ACTION_UP  mActivePointerId INVALID_POINTER_ID break  case MotionEvent.ACTION_CANCEL.. 
 Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger  if event.getAction MotionEvent.ACTION_UP Point point new Point point.x event.getX point.y event.getY points.add point invalidate Log.d TAG point point return true return super.onTouchEvent event and add the dx dy values to the Point class class Point.. 
 |