For TextView or edittext dynamic settings drawableleft,drawableright,drawabletop,Drawablebottom, Drawablestart,A summary of drawableend methods
Many dynamic settings are available in Android
but the problem with easy-to-use is that we often only invoke some of the above methods, but do not set drawable's bounds to specific data , causing these images to not be displayed, so do the following:
Set the right-pointing image
drawable drawable = Getresources (). getdrawable (R.drawable.hotel_search);d rawable.setbounds (0, 0, Drawable.getintrinsicwidth (), Drawable.getintrinsicheight ()), selectcitytv.setcompounddrawables (null, NULL, drawable, NULL);
Or we can use some other method
Selectcitytv.setcompounddrawableswithintrinsicbounds (drawable left, drawable top,drawable right,Drawable bottom)
-------will not experiment here--------
Try doing it
How Android dynamically sets the TextView Drawableleft