[英]Android Scrollview doesn't scroll
I am trying to make an whole view of a scrollView but the scrollView doesn't scroll.我正在尝试制作 scrollView 的整体视图,但 scrollView 不滚动。
Please help me:)请帮我:)
Here is my xml code :这是我的 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="wrap_content"
android:scrollbars="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="40dp"
android:padding="20dp"
android:background="@android:color/white"
android:id="@+id/mainlayout"
>
////some content here
</LinearLayout>
</ScrollView>
Change your ScrollView android:layout_height
to match parent.更改您的 ScrollView
android:layout_height
以匹配父级。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical">
将滚动视图更改为android.support.v4.widget.NestedScrollView
并将height
属性设置为match_parent
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.