滚动视图无法正常使用填充

Scroll View not work properly with padding

我的 Activity 有问题。 ScrollView 不会向下滚动到底部。 这是我的 XML 布局 ScrollView:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/test"
            android:paddingRight="@dimen/layoutsPadding"
            android:paddingTop="@dimen/layoutsPadding"
            android:paddingLeft="@dimen/layoutsPadding"
            android:paddingBottom="@dimen/scrollViewLayoutsPadding">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/tab_introduction_background"
        android:orientation="vertical"
        android:padding="@dimen/layoutsPadding">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/tab_introduction_title"
            android:textSize="@dimen/bigFont"></TextView>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="@dimen/gap_titleAndText">
        </LinearLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/tab_introduction_description"
            android:textSize="@dimen/smallFont"></TextView>
    </LinearLayout>

</ScrollView>

我能做什么?

既然删除 LinearLayout 的填充有效,但你希望它有填充,为什么不用另一个 LinearLayout 包围它,只让这个外部 LinearLayout 有一个填充。并删除内部 LinearLayout 的填充。这可能不是一个很好的风格,但值得一试。

如果您想避免这种情况,您也可以尝试从 LinearLayout 中删除填充并为其所有子项添加边距。

编辑:既然你真的需要那个填充,在底部添加一个空视图肯定会解决你的问题,但这也不是一个好的解决方案:

<View
android:layout_width="fill_parent"
android:layout_height="30dp" />