[英]Scroll View not work properly with padding
I have a problem in my Activity
. 我的
Activity
有问题。 The ScrollView
doesn't scroll down to the bottom. ScrollView
不会向下滚动到底部。 Here's my XML layout of the ScrollView
: 这是
ScrollView
XML布局:
<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>
What Can I do? 我能做什么?
Since removing LinearLayout
's padding worked, but you want it to have padding, why not just surround it with another LinearLayout
and let only this outer LinearLayout
to have a padding. 由于删除
LinearLayout
的填充是LinearLayout
的,但是您希望它具有填充,所以为什么不只将其与另一个LinearLayout
包围,而只让此外部LinearLayout
具有填充。 And remove the inner LinearLayout
's padding. 并删除内部
LinearLayout
的填充。 This is probably not a very good style, but worth a try. 这可能不是很好的样式,但是值得一试。
If you want to avoid this, you can also try removing the padding from the LinearLayout
and adding a margin to all it's children. 如果要避免这种情况,还可以尝试从
LinearLayout
删除填充,并为其所有子项添加边距。
EDIT: Since you really need that padding, adding an empty view at the bottom will definitely solve your problem, but it's not a good solution either: 编辑:由于您确实需要填充,在底部添加一个空视图肯定会解决您的问题,但这也不是一个好的解决方案:
<View
android:layout_width="fill_parent"
android:layout_height="30dp" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.