<ImageButton
android:id="@+id/mediacontroller_play_pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:background="@drawable/mediacontroller_button"
android:contentDescription="@string/mediacontroller_play_pause"
android:src="@drawable/mediacontroller_pause" />

使用 更换src图片

mPauseButton.setImageResource(getResources().getIdentifier(
"mediacontroller_play", "drawable",
mContext.getPackageName()));

05-11 16:23