我有一个包含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文件中定义的按钮数量吗?