我有一个带有RelativeLayout的ScrollView。我将在底部有2/3个按钮,但它们不会停留在底部。谁能看到我在哪里做错了事?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/activity_bygg"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="110dp"
android:layout_height="wrap_content"
android:text="@string/hjem"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="110dp"
android:layout_height="wrap_content"
android:text="@string/neste"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</ScrollView>
如果检查正确,则按钮位于相对布局的底部。问题是没有全屏显示的滚动视图。检查此xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:id="@+id/activity_bygg"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="@string/hjem"/>
<Button
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:text="@string/neste"/>
</RelativeLayout>
</ScrollView>
如果您注意到我在scrollview中插入了android:fillViewport =“ true”
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句