2016-07-20 33 views
1

我在Recycler View中使用多行EditText作爲列表項目。我的問題是,EditText在Recycler視圖內不能平滑滾動。使用多行edittext查看

下面是我用

對於回收站查看

<android.support.v7.widget.RecyclerView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@+id/rec_actions" 
        android:layout_above="@+id/sepp" 
        android:nestedScrollingEnabled="true" /> 

對於列表項的XML

<android.support.v4.widget.NestedScrollView 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_weight="2" 
       android:background="@drawable/commentbox_bgright"> 

       <EditText 
        android:id="@+id/et_control" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:background="@null" 
        android:gravity="top" 
        android:minLines="4" 
        android:padding="5dp" 
        android:scrollbars="vertical" 
        android:textCursorDrawable="@null" 
        android:textSize="12dp" /> 
      </android.support.v4.widget.NestedScrollView> 

請幫我在這。我花了很多時間在這...

回答

0

我試過你的代碼,並且做了一些小改動。我刪除了nestedscrollview,並將edittext放在相對佈局中。滾動工作點更順利,沒有注意到任何其他滾動行爲的變化,所以建議改變你的列表項xml這樣。

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:padding="10dp"> 

    <EditText 
       android:id="@+id/et_control" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:background="@null" 
       android:gravity="top" 
       android:minLines="4" 
       android:padding="5dp" 
       android:scrollbars="vertical" 
       android:textCursorDrawable="@null" 
       android:textSize="12dp" /> 
</RelativeLayout> 
+0

謝謝您的回答,但我已經嘗試過這一點,它不工作。 –