Tôi đang sử dụng một nút
Programatically thay đổi drawableLeft của Button
<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" />
và thay đổi màu chữ của nó với:
zoom.setTextColor(Color.parseColor("voilet"));
nhưng không thể hiểu how to change its image??
hãy nhìn vào http://developer.android.com/guide/topics/ui/controls /button.html#CustomBackground để tạo kiểu cho nút của bạn – Eluvatar
đặt như thế này button.setBackground (R.drawable.ic_launcher); bên trong trình nghe onclick. – Aravin
Bản sao có thể có của [Làm cách nào để thiết lập drawableLeft trên nút Android?] (Http://stackoverflow.com/questions/4502605/how-to-programatically-set-drawableleft-on-android-button) – Varun