打赏

Android动态设置drawableRight

Drawable rightDrawable = getResources().getDrawable(R.drawable.icon); //调用setCompoundDrawables时,必须调用Drawable.setBounds()方法,否则图片不显示 rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight()); // left, top, right, bottom 
RadioButton.setCompoundDrawables(null, null, rightDrawable, null); 
// left, top, right, bottom
posted @ 2023-04-12 14:19  张学涛  阅读(51)  评论(0编辑  收藏  举报