android table 布局上边距
android table layout top margin
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:background="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="0.95"
android:layout_marginLeft="0.1dp"
android:layout_marginBottom="0.1dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
>
<EditText
android:id="@+id/et_1"
android:layout_weight="0.1"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="match_parent"
android:layout_width="0dp"
android:text="hell wolrd"
android:inputType="text"
/>
<EditText
android:id="@+id/et_2"
android:layout_weight="0.55"
android:layout_marginTop="0dp"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:paddingTop="5dp"
android:text="hell wolrd"
android:inputType="textCapSentences|textMultiLine"
/>
<Spinner
android:id="@+id/spinner_3"
android:layout_weight="0.15"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="match_parent"
android:layout_width="0dp"
></Spinner>
<EditText
android:id="@+id/et_4"
android:layout_weight="0.15"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="match_parent"
android:layout_width="0dp"
android:inputType="text"
/>
</TableRow>
</TableLayout>
</LinearLayout>
这是我的 xml 文件,其中显示了以下结果。
但是当我 运行 代码时,屏幕显示如下:
第二个编辑文本出现问题。如果有人可以提供帮助,请
可能的原因是什么?
这是保证金吗?
为什么当我没有更改 Class 文件中的任何内容时会发生这种情况。
请更改
android:layout_height="wrap_content"
在 EditText(et_2) 到
android:layout_height="match_parent"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:background="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="0.95"
android:layout_marginLeft="0.1dp"
android:layout_marginBottom="0.1dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"
>
<EditText
android:id="@+id/et_1"
android:layout_weight="0.1"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="match_parent"
android:layout_width="0dp"
android:text="hell wolrd"
android:inputType="text"
/>
<EditText
android:id="@+id/et_2"
android:layout_weight="0.55"
android:layout_marginTop="0dp"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:paddingTop="5dp"
android:text="hell wolrd"
android:inputType="textCapSentences|textMultiLine"
/>
<Spinner
android:id="@+id/spinner_3"
android:layout_weight="0.15"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="match_parent"
android:layout_width="0dp"
></Spinner>
<EditText
android:id="@+id/et_4"
android:layout_weight="0.15"
android:layout_marginRight="0.1dp"
android:background="@color/color_white"
android:layout_height="match_parent"
android:layout_width="0dp"
android:inputType="text"
/>
</TableRow>
</TableLayout>
</LinearLayout>
这是我的 xml 文件,其中显示了以下结果。
但是当我 运行 代码时,屏幕显示如下: 第二个编辑文本出现问题。如果有人可以提供帮助,请 可能的原因是什么? 这是保证金吗? 为什么当我没有更改 Class 文件中的任何内容时会发生这种情况。
请更改
android:layout_height="wrap_content"
在 EditText(et_2) 到
android:layout_height="match_parent"