我在視圖中有一個圖像按鈕,我需要在用戶交互後進行更改。我不覺得沒有像myImageButton.setDrawable
這裏是我的,我想更改按鈕的xml:如何以編程方式替換/更改圖像按鈕android
<ImageButton
android:id="@+id/stopButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/buttons_background"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@null"
android:src="@drawable/btn_play" />
我需要改變android:src="@drawable/btn_play"
到android:src="@drawable/btn_stop"
編程的唯一線路。這可以做到嗎?提前致謝。
非常感謝您的幫助 – madcoderz 2013-05-13 18:37:18