5 つのボタンを含むウィジェットがあります。ボタンがクリックされたときにそのような動作を実装するにはどうすればよいですか?ウィジェットの下の拡張可能なパネルには、より多くのボタンが表示されますか? 別のボタンをクリックすると、別のパネルが表示されます...
したがって、私の最初のウィジェットのレイアウトは次のようになります。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:background="@drawable/smc_icon"
android:textColor="#FFFFFF"
/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:background="@drawable/smc_icon"
android:textColor="#FFFFFF"
/>
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:background="@drawable/smc_icon"
android:textColor="#FFFFFF"
/>
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:background="@drawable/smc_icon"
android:textColor="#FFFFFF"
/>
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:background="@drawable/smc_icon"
android:textColor="#FFFFFF"
/>
別の質問: リソース xml ファイルで定義した数のボタンをレンダリングするアクティビティを実装できますか?