Ael*_*exe 6 layout android padding scrollview
我目前正在使用ScrollView中包含RelativeLayout的布局.
我希望RelativeLayout包含在距离ScrollView底部5dp的位置,因此它不会与我背后的背景重叠,为了实现这一点,我使用的是这样的XML:
<ScrollView
android:id="@+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/backgroundView1"
android:fadingEdge="none"
android:scrollbars="none"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<RelativeLayout
android:id="@+id/innerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
这很好用,但我不再需要在顶部填充.删除paddingTop行时,paddingBottom不再起作用.即使我将paddingBottom设置为100dp,它也不会对我的布局产生影响.
我尝试了paddingTop ="0dp"并且也没有解决问题,看起来paddingBottom只有在paddingTop高于0时才能工作.
任何人都有任何想法,为什么paddingBottom没有paddingTop不起作用?
您编写了 xml 属性android:layout_alignParentBottom="true",因此您的ScrollView将始终与底部对齐。
删除android:layout_alignParentBottom="true"并重试。
| 归档时间: |
|
| 查看次数: |
33802 次 |
| 最近记录: |