画像ボタンに前景画像を設定しようとしています。いくつかの調査の後、私はこのコードサンプルに出くわしました:
<ImageButton android:text="Button" android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
私の質問は、コードで android:src を実際に実装する方法です。