2017-10-29 230 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">