我想更改保留的圖像按鈕的圖像,並在發佈時更改它。 這裏是我的主要代碼幫助編輯這個。 XML代碼:更改圖像按鈕保留
<ImageButton
android:layout_width="62dp"
android:layout_weight="1"
android:layout_height="60dp"
android:id="@+id/im1"
android:layout_gravity="fill_horizontal"
android:src="@drawable/off1"/>
和java代碼:
im1 = (ImageButton) findViewById(R.id.im1);
im1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//some codes
}
});
使用imagebutton選擇器 – San