繁体   English   中英

android表格布局的上边距

[英]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"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM