我在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>
在Android Studio中,我可以看到就在那里,去年元素,如下图所示: 但是,当我我真正的设备上运行它,最后一个元素不能正常显示,我的最后一个按钮丢失: 我瞪大眼睛了一些网页,并表示只需添加
android:fillViewport="true"
scrolView ..但这不能解决我的问题....我已经添加了另一个XML标签,但仍然没有... 任何想法...... ????
非常感谢你...... :)
尝试删除android:layout_gravity =结束我认为它不需要 – Jois
尝试给填充滚动视图到底部... –
我需要layout_gravity =结束先生Jois ... :) –