ボタンの背景をダイナミックに変えるでは、背景の変え方について触れました。 今回は、ボタンへ、イベントを追加する方法について紹介します。 <Button android:text="@string/button" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> キーワードはsetContentView、findViewById、setOnClickListener、Activity implements OnClickListenerなどです。 レイアウトファイルにボタンを配置して、リスナーを登録する部分を続きに解説しました。 レイアウトファイルにボタンを配置する res/