Android 如何在每个文本字段的顶部创建带有文本字段说明的间隔文本字段
我是android开发的新手,我想知道如何创建间隔文本字段,并在每个文本字段的顶部添加一个名称。任何帮助都将不胜感激 到目前为止我编写的代码Android 如何在每个文本字段的顶部创建带有文本字段说明的间隔文本字段,android,android-layout,Android,Android Layout,我是android开发的新手,我想知道如何创建间隔文本字段,并在每个文本字段的顶部添加一个名称。任何帮助都将不胜感激 到目前为止我编写的代码 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AddContact" >
<EditText
android:id="@+id/edit_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter name" >
</EditText>
<EditText
android:id="@+id/edit_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter number" >
</EditText>
</LinearLayout>
希望以下代码对您有所帮助, 您必须将TextView置于EditText之间以提供参考
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AddContact" >
<TextView
android:id="@+id/lbl_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Name"
/>
<EditText
android:id="@+id/edit_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter name" >
</EditText>
<TextView
android:id="@+id/lbl_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Number"
/>
<EditText
android:id="@+id/edit_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter number" >
</EditText>
</LinearLayout>
<TextView
android:id="@+id/lbl_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Name"
/>
<EditText
android:id="@+id/edit_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter name" >
</EditText>
<TextView
android:id="@+id/lbl_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Number"
/>
<EditText
android:id="@+id/edit_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter number" >
</EditText