我突然遇到了一个问题,即ScrollView扩展到屏幕底部之外,因此即使您滚动到最底部,它也不会显示所有内容。XML代码为:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFFFF">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="#FFBBBBBB"
android:orientation="vertical" >
<View
android:layout_width="100dp"
android:layout_height="300dp"
android:layout_margin="15dp"
android:layout_gravity="center_horizontal"
android:background="#FFDDDDFF"/>
<View
android:layout_width="100dp"
android:layout_height="300dp"
android:layout_margin="15dp"
android:layout_gravity="center_horizontal"
android:background="#FFDDDDFF"/>
</LinearLayout>
</ScrollView>
那就没有比这更简单的了。一旦您滚动到最底部(根据滚动条的形状指示),您应该看到底部的白色边距,但实际上它看起来是这样的:
![scrollview的底部](https://istack.dev59.com/LloeL.webp)
![scrollview的顶部](https://istack.dev59.com/yjvAY.webp)
请勿猜测和草率行事! 只有经过测试的答案。 我已经因为这件事浪费了足够的时间。谢谢。