How to programmatically re-apply a 9-patch image to an ImageView?

后端 未结 5 1855
挽巷
挽巷 2020-12-03 23:24

I have an activity that has an ImageView defined inside a HorizontalScrollView. The image source is a 9-patch file that is constrained to stretch only the right edge to fill

5条回答
  •  时光取名叫无心
    2020-12-03 23:42

    Move this: ImageView imgResultMap = (ImageView)findViewById(R.id.imgResultMap); to a global intialized in the onCreate method. Otherwise the device has to search for the view and find it every time it is tapped.

    and try calling imgResultMap.invalidate(); before you return from the onDoubleTap method (http://developer.android.com/reference/android/view/View.html#invalidate())

提交回复
热议问题