我正在使用一个按钮
<Button
android:id="@+id/zoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/trans"
android:drawableLeft="@drawable/left_img"
android:fontFamily="arial"
android:text="My Name is "
android:textSize="50sp" />
并使用 :
zoom.setTextColor(Color.parseColor("voilet"));
但无法理解如何更改其图像??
最佳答案
试试这个:
int imgResource = R.drawable.left_img;
button.setCompoundDrawablesWithIntrinsicBounds(imgResource, 0, 0, 0);
关于android - 以编程方式更改按钮的 drawableLeft,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18278003/