2016-10-20 10 views
0

の外にスクロールビューを開始するには、私はRecyclerView上記の項目(のTextViewを持ってボトムシートで適切にボトムシートRecyclerview上記のビューを保持している - ビュー

を動作するように底部シートを得ることで問題を抱えていますこの場合は両方ともスクロールしたいので、両方ともNestedScrollViewにラップされています)。

問題が発生すると、画面が読み込まれたときにTextViewが非表示になり、リサイクルビューを下にスクロールして表示する必要があります。

TextViewが既に表示されているようにするにはどうすればよいですか?それは(それが起動するべきか)それを下にスクロールした後にどのように見えるか how it starts を開始する方法

`` `

<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:behavior_hideable="false" 
    app:behavior_peekHeight="auto" 
    app:layout_behavior="@string/bottom_sheet_behavior"> 
    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true"> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="100dp" 
       android:background="@color/colorPrimaryDark" 
       android:gravity="center" 
       android:text="GYUHGHJG"/> 
      <android.support.v7.widget.RecyclerView 
       android:id="@+id/recyclerview" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 
     </LinearLayout> 
    </android.support.v4.widget.NestedScrollView> 
</FrameLayout> 

` `` how it looks after scrolling it down and how it SHOULD start

答えて

1

私が試してみました回避策とそれは働いた! これは有効な解決策ではありませんが、他のオプションはありません。 例では、線形レイアウトの代わりに相対レイアウトを使用してみてください。 Recyclerビューに上部パディングを提供します。

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="100dp" 
     android:background="@color/colorPrimaryDark" 
     android:gravity="center" 
     android:text="GYUHGHJG"/> 
    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recyclerview" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="25dp"/> 
</RelativeLayout> 
+0

私はこの問題を他の場所で実行したと思います。その解決策は、(RecyclerViewの前に)トップビューを 'focusableInTouchMode' – kassim

関連する問題