2017-10-29 213 views
-1

我想做一个scrollView的整个视图,但scrollView不滚动。Android的滚动视图不滚动

请帮我:)

这里是我的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> 
+0

你的linearlayout里面有什么内容?里面有recyclerview吗? – ZeroOne

+0

其:android.support.design.widget.TextInputLayout – user3693265

+0

scrollview会影响如果里面的视图里面的linearlayout超出设备视图..试着把更多的视图放在里面.. – ZeroOne

回答

0

更改您的滚动视图android.support.v4.widget.NestedScrollViewheight属性设置为match_parent

+0

它根本不滚动 – user3693265

+0

@ user3693265粘贴您的完整代码 –

1

更改滚动型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">