は単に
レイアウト/ header.xml
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/recyclerViewWidth"
android:layout_height="@dimen/yourTextViewHeight"
android:background="@android:color/transparent" />
使用RecyclerViewのヘッダとしてこのレイアウトのようにそののTextViewの同じ高さのレイアウトを作成します。
これがあなたの問題を解決することを願っています。
EDIT:
私はあなたのレイアウトは、このような場合、ヘッダとして(iは上記specicied) 'レイアウト/ header.xml' を使用して解決する本
よう
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black"
android:alpha="0.8"
android:text="@string/action_switch"
android:textColor="@android:color/white" />
</FrameLayout>
であると考えられ問題。最初のアイテムのヘッダーは透明であるため、表示されないためです。 2番目の項目をスクロールすると、TextView
の後ろに移動するように見えます。
EDIT 2:
あなたはまた、別の方法を使用することができます。 RecyclerView
の商品のレイアウトにlayout/header.xml
'を含めてください。それは項目他の1 setVibility(false)
これは興味深い提案です。私はこれを後で試してみる。 – Simon