android - 如何在 ScrollView 下方添加空间

标签 android android-layout android-scrollview

我在 scroll view 中包装了一个 Activity ,如下所示。

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    >

    <include layout="@layout/content_form" />

</ScrollView>

我在 content_form 布局中有大约 15 个字段,问题是 content_form 布局中的最后一项附在底部。

我需要在 ScrollView 下方添加边距,我已尝试为 scrollviewcontent_form 字段的最后一项提供边距,但没有任何效果。

我需要知道如何在使用 ScrollView 时在页面底部添加边距。

最佳答案

如果希望滚动边距在内容内,最好将其添加到content_form。您应该能够通过将 paddingBottom 添加到该布局中的父容器,或者在最后一个与父底部对齐的 View 上添加 layout_marginBottom 来实现这一点。

关于android - 如何在 ScrollView 下方添加空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51027923/

相关文章:

Android - Horizo​​ntalScrollView 在键盘打开时向右滚动

android - ScrollView 和 ConstraintLayout 在底部留下巨大的空白

android - 如何使 Bottom Sheet (BottomSheetBehavior)可扩展到任意位置?

android - 当 Activity 完全布局并准备好进行用户交互时,会调用哪个方法?

android - 牙签 NoFactoryFoundException

android - 我想为商店中的 android 和 ios 应用程序生成相同的 URL

android - 如何设置特定于平板电脑 9.7"的布局

android - 如何在android中从手势输入中写入和读取文本?

android - 为什么 Fragment 的 ScrollView 中的 LinearLayout 是 NULL 对象?

Android:VerticalViewPager 中的垂直 ScrollView 无法正常工作