ScrollView无法显示最后一个元素

Hyo*_*ipo 3 xml android

我在android studio中做了一个简单的布局,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    tools:context="hisoka.poipo.com.wishtleblower.KorupsiActivity"
    android:scrollIndicators="right"
    android:fillViewport="true"
    android:layout_weight="1"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#F0FFFF"
            android:layout_marginTop="@dimen/topMargin"
            android:layout_marginBottom="@dimen/bottomMargin"
            android:layout_marginLeft="@dimen/leftMargin"
            android:layout_marginRight="@dimen/rightMargin"
            android:orientation="vertical">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Keterangan :"
            android:textStyle="bold"
            android:layout_centerInParent="true"/>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:inputType="textMultiLine"
                android:ems="10"
                android:background="@drawable/box"
                android:id="@+id/ket_et" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#B0E0E6"
            android:layout_marginTop="@dimen/topMargin"
            android:layout_marginBottom="@dimen/bottomMargin"
            android:layout_marginLeft="@dimen/leftMargin"
            android:layout_marginRight="@dimen/rightMargin"
            android:orientation="vertical">
            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="Terduga :"
                android:layout_weight="1"
                android:textStyle="bold"
                android:layout_margin="4dip"
                 />

            <TextView
                android:layout_height="wrap_content"
                android:fontFamily="sans-serif"
                android:text="Nama :"
                android:layout_weight="1"
                android:layout_margin="4dip"
                android:layout_width="wrap_content"
                 />
            <EditText
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/box"
                android:layout_margin="4dip"
                android:layout_width="match_parent"
                />

            <TextView
                android:layout_height="wrap_content"
                android:fontFamily="sans-serif"
                android:text="Jabatan :"
                android:layout_weight="1"
                android:layout_margin="4dip"
                android:layout_width="wrap_content"
                 />
            <EditText
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/box"
                android:layout_margin="4dip"
                android:layout_width="match_parent"
                />

            <TextView
                android:gravity="center_vertical"
                android:text="Klasifikasi Jabatan :"
                android:layout_height="wrap_content"
                android:fontFamily="sans-serif"
                android:layout_margin="4dip"
                android:layout_weight="1"
                android:layout_width="wrap_content"
                 />

                <Spinner
                    android:id="@+id/korupsiSpinnera"
                    android:layout_weight="1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <TextView
                    android:layout_height="wrap_content"
                    android:fontFamily="sans-serif"
                    android:text="Nama :"
                    android:layout_weight="1"
                    android:layout_margin="4dip"
                    android:layout_width="wrap_content"
                    />
            <EditText
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/box"
                android:layout_margin="4dip"
                android:layout_width="match_parent"
                />
                <TextView
                    android:layout_height="wrap_content"
                    android:fontFamily="sans-serif"
                    android:text="Jabatan :"
                    android:layout_weight="1"
                    android:layout_margin="4dip"
                    android:layout_width="wrap_content"
                    />
            <EditText
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/box"
                android:layout_margin="4dip"
                android:layout_width="match_parent"
                />

                <TextView
                    android:gravity="center_vertical"
                    android:text="Klasifikasi Jabatan :"
                    android:layout_height="wrap_content"
                    android:fontFamily="sans-serif"
                    android:layout_margin="4dip"
                    android:layout_weight="1"
                    android:layout_width="wrap_content"
                    />
                <Spinner
                    android:id="@+id/korupsiSpinnerb"
                    android:layout_weight="1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
         </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#B0E0E6"
        android:layout_marginTop="@dimen/topMargin"

        android:layout_marginLeft="@dimen/leftMargin"
        android:layout_marginRight="@dimen/rightMargin"
        android:orientation="vertical">
        <TextView
            android:gravity="center_vertical"
            android:text="Lampiran :"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="Nama File "
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="Rfounder "
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="Keterangan "
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="CEO "
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="Size "
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="36 KB "
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="Delete "
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="X"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:text="Add File"
            />
        </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#B0E0E6"
        android:layout_marginTop="@dimen/topMargin"
        android:layout_marginBottom="@dimen/bottomMargin"
        android:layout_marginLeft="@dimen/leftMargin"
        android:layout_marginRight="@dimen/rightMargin"
        android:gravity="bottom"
        android:orientation="vertical">
        <TextView
            android:gravity="center_vertical"
            android:text="Kirim Laporan"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <TextView
            android:gravity="center_vertical"
            android:text="Captcha"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-condensed"
            android:layout_margin="4dip"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            />
        <EditText
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/box"
            android:layout_margin="4dip"
            android:layout_width="wrap_content"
            android:ems="7"
            />
        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New CheckBox"
            android:id="@+id/checkBox"
            android:layout_weight="1" />
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:text="Submit"
            android:gravity="bottom"
            />
    </LinearLayout>

    </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

在android studio中,我可以看到最后一个元素,如下所示: 在android studio中预览 但是当我在我的真实设备上运行它时,最后一个元素无法显示,我的最后一个按钮丢失了: 真实设备 我已经对一些页面进行了调整并说只需添加

android:fillViewport="true"
Run Code Online (Sandbox Code Playgroud)

to scrolView ..但这不能解决我的问题....我已经添加了另一个xml标签但仍然没有...任何想法...... ????

非常感谢... :)

Hyo*_*ipo 7

感谢Er先生的建议.Arjun,我终于得到了答案......我把它放了

android:paddingBottom="57dp"
Run Code Online (Sandbox Code Playgroud)

滚动浏览......它已修复...... :)

在此输入图像描述