在下面发布的xml
文件中,我希望scrollView
高于button
,Button
无论scrollView
如何都不会消失扩展。我尝试按照发布的xml
文件中提到的方式执行此操作,但问题是当scrollView
扩展按钮消失时。
请让我知道我错过了什么。
XML
<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="wrap_content" android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal">
<Button
android:id="@+id/btn_00"
android:text="OrientierungsPruefung"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</LinearLayout>
答案 0 :(得分:0)
试试这个:
<LinearLayout 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" android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/textView" />
</ScrollView>
<Button
android:id="@+id/btn_00"
android:text="OrientierungsPruefung"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
您的相对布局是不必要的! 无论ScrollView的内容如何,始终会显示底部的按钮。关键是设置layout_weight = 1!