的drawableLeft我使用一個按鈕
編程方式更改按鈕
<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"));
,但無法理解how to change its image??
看看http://developer.android.com/guide/topics/ui/controls /button.html#CustomBackground來設置你的按鈕 – Eluvatar
像這樣button.setBackground(R.drawable.ic_launcher);在onclick監聽器中。 – Aravin
[如何以編程方式設置drawableLeft on Android按鈕?](http://stackoverflow.com/questions/4502605/how-to-programatically-set-drawableleft-on-android-button) – Varun