0

我正在尝试将我的 assistant_update_btn 与屏幕底部对齐,但它似乎没有这样做。由于某种原因,它位于 TextView 的正下方,并且由于某种原因未与屏幕底部对齐。

非常感谢任何输入。

<?xml version="1.0" encoding="utf-8"?>
<!-- LinearLayout allows border to expand to entire screen -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical" >
>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/apn_app_text_cta2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="18sp"
                android:layout_marginTop="30sp"
                android:layout_marginLeft="30sp"
                android:layout_marginRight="30sp"
                android:textColor="#000000"
                android:text="@string/apn_app_text_cta2"/>


            <ImageView
                android:id="@+id/assist_update_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/apn_app_text_cta2"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:src="@drawable/btn_next_inactivei" />

        </RelativeLayout>

</ScrollView>
4

3 回答 3

1

android:fillViewport="true"在布局中尝试以下代码。添加ScrollView和删除 android:layout_below="@+id/apn_app_text_cta2"ImageView

<!-- LinearLayout allows border to expand to entire screen -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"

 >


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/apn_app_text_cta2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="18sp"
                android:layout_marginTop="30sp"
                android:layout_marginLeft="30sp"
                android:layout_marginRight="30sp"
                android:textColor="#000000"
                android:text="@string/apn_app_text_cta2"/>


            <ImageView
                android:id="@+id/assist_update_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:src="@drawable/btn_next_inactivei"/>

        </RelativeLayout>

</ScrollView>

这应该工作

于 2013-10-11T18:52:33.937 回答
0

这是因为这条线

android:layout_below="@+id/apn_app_text_cta2"

删除它,你应该得到预期的结果。该行与将其与其父级的底部对齐相冲突。

于 2013-10-11T18:40:31.010 回答
0

发生这种情况是因为 ScrollView 不会将整个屏幕设置android:fillViewport="true"为滚动视图,也不会从其中移除android:layout_below="@+id/apn_app_text_cta2"ImageView实现该目的。

于 2013-10-11T18:46:01.713 回答