如何在android中创建更多edittext字段?
我正在从事android项目。我需要创建一些字段,如下图所示 这里我只显示了4列,但我有8到10列。 在某种程度上,我可以动态生成编辑文本。如何在android中创建更多edittext字段?,android,Android,我正在从事android项目。我需要创建一些字段,如下图所示 这里我只显示了4列,但我有8到10列。 在某种程度上,我可以动态生成编辑文本。 如何在android屏幕中创建这些字段 您可以使用4个编辑文本作为表格的行来创建ListView。行数将由ListView自动生成。您好,您可以使用下面的TableLayout、TextView和EditText <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andr
如何在android屏幕中创建这些字段 您可以使用4个编辑文本作为表格的行来创建ListView。行数将由ListView自动生成。您好,您可以使用下面的TableLayout、TextView和EditText
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TableRow android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Location"
android:layout_weight="1"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Name"
android:layout_weight="1"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Age"
android:layout_weight="1"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Gender"
android:layout_weight="1"/>
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="1"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="2"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="3"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="4"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="5"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<EditText android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
</LinearLayout>
请解释为什么不能使用表格布局。依我看,桌子布局是最好的选择。如果有其他更好的方法,请告诉我。重新设计手机/触摸屏的用户界面。