Android 在代码中修改TextView的DrawableRight等方向上的图片
在XML文件中可以对TextView进行设置:👇👇
android:drawableTop="@drawable/XXX"       
android:drawableBottom="@drawable/XXX"         
android:drawableRight="@drawable/XXX"
android:drawableLeft="@drawable/XXX"
在java代码中相应设置为:👇👇👇
Drawable drawable = getResources().getDrawable(R.drawable.XXX);
// setBounds(top, bottom, right, left)  方向是  上,下,右,左;在想要设置的第几个坑里填上对应的图片,其他位置填上null即可,该参数若未设置,本人的测试是无法显示图片的
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
textView.setCompoundDrawables(null, null, drawable, null);
感谢:https://blog.csdn.net/u014624241/article/details/76849430
    The one who wants to wear the crown, bears the crown.
                    
                
                
            
        
浙公网安备 33010602011771号