1
我有一个具有相对布局的活动。如何根据用户选择更改布局元素
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFFFFF">
<TextView android:id="@+id/time_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "Name :"
android:textSize = "14sp"
android:textColor = "#000000"
android:textStyle = "bold"
android:layout_gravity="center_vertical|center_horizontal"
/>
<Spinner android:id="@+id/spinner_time"
android:layout_height="40dp"
android:layout_width="match_parent"
android:prompt="@string/time_list"
android:layout_below = "@+id/time_label"
android:layout_marginLeft = "5dp"
android:layout_marginRight = "5dp">
</Spinner>
<TextView></TextView>
<EditText></EditText>
<ImageButton></ImageButton>
</RelativeLayout>
现在根据用户从微调选择我需要改变布局元素像2按钮3 textview或4按钮1 textview。所以对于这个我必须采取在xml布局的所有元素,并使用“android:知名度”可选显示根据用户选择或有任何其他更好的方式来做到这一点,因为我发现这种方法有点混乱。
感谢
我更喜欢使用充气器,因为Pravin说 – 2011-06-13 13:08:24
谢谢,明白了。你能指点我一个包含基本代码的例子吗? – Rishi 2011-06-14 06:38:01