0
我有下面的XML布局驾驶我的UI:如何以编程方式在Android中换出视图控件?
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1"
android:layout_margin="10dp" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username:" />
<EditText
android:id="@+id/txtUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" >
</EditText>
</TableRow>
<!-- more rows are here -->
</TableLayout>
我想重用此布局为我的应用程序的其他部分,但在一个地方改变一些东西稍稍。我想EditText
txtUsername
更改为TextView
,在相同的位置和一切。所以基本上我换出了代码中的TextView的EditText。
我该怎么做?
完美,谢谢! – 2012-07-19 23:55:23