滚动视图底部的Android按钮(Android Buttons at the bottom in a scrollview)
我有一个带有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>I have a ScrollView with a RelativeLayout. I'm gonna have 2 / 3 buttons at the bottom, but they wont stay at the bottom. Can anyone see where i did things wrong?
<?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”
if you check correctly the buttons are at the bottom of the relative layout. The problem is the scrollview that is not taking full screen. Check this 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>If you notice i have inserted the android:fillViewport="true" at scrollview
更多推荐
发布评论