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

后端 未结 5 1874
挽巷
挽巷 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:48

    Also another solution is to set image programmatically as ImageResource and set scaleType

    imageView.setImageResource(R.drawable.favorite_driver_icon);
    imageView.setScaleType(ScaleType.FIT_XY);
    

提交回复
热议问题