我正在尝试使用EditText和关联的标签创建视图.我将它们放在GridLayout中.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"
tools:context="mobi.designmyapp.osmtemplate.note.NoteActivity"
android:orientation="vertical">
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2"
android:rowCount="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/comment_edit_text"
android:text="@string/comment_label"
android:padding="8dp"
android:textColor="@color/background_material_dark"
android:maxLines="5"
/>
<EditText
android:id="@+id/comment_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/comment_text_hint"/>
</GridLayout>
Run Code Online (Sandbox Code Playgroud)