Linearlayout 的内容经常会超出屏幕,虽然有scrollbars="vertical"参数可以设置,然而并没有用。
正确的做法是在LinearLayout外嵌套一层ScrollView。
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadingEdge="vertical"
android:scrollbars="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请选择日期:"
android:textColor="@android:color/holo_blue_dark"
android:textSize="22sp" />
当LinearLayout的内容超出屏幕时,直接设置scrollbars属性可能无效。正确解决方案是在LinearLayout外包裹一个ScrollView,确保滚动功能正常工作。博客详细介绍了如何通过在布局XML中正确使用ScrollView来避免内容溢出。
3389

被折叠的 条评论
为什么被折叠?



