このような出力が必要です。これは、VerticalRecyclerViewのヘッダーとしてHorizontalRecyclerViewです。Horizontal RecyclerviewをVertical Recyclerviewのヘッダーとして追加する方法は?
現在、私はこのデザインを達成するためにNestedScrollViewを使用しています。しかしスクロールがスムーズでないと感じました。
ご提案ください。前もって感謝します。
レイアウト:
<android.support.v4.widget.NestedScrollView
android:id="@+id/nsv_my_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="ifContentScrolls"
android:visibility="gone"
android:clipChildren="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="15dp">
<LinearLayout
android:id="@+id/ll_continue_watching"
android:layout_width="match_parent"
android:layout_height="132dp"
android:visibility="gone"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="29dp"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<customview.font.TextView
android:id="@+id/txt_edit_remove_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/btn_profile_edit"
android:gravity="center"
android:paddingTop="2dp"
android:text="EDIT"
android:textSize="10sp" />
<customview.font.TextView
android:id="@+id/txt_continue_watchng"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:text="Continue watching"
android:textSize="12sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/horizontal_view_color" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_horizontal_view"
android:layout_width="match_parent"
android:layout_height="102dp"
android:paddingBottom="15dp"
android:paddingTop="15dp" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/horizontal_view_color" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_vertical_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
トップで横スクロールするためにRecyclerViewを使用する理由をもう少し説明できますか?おそらく 'TabLayout'を使うだけで十分でしょうか? (https://developer.android.com/reference/android/support/design/widget/TabLayout.html) –
とスクロール可能なタブについてはこちらをご覧くださいhttp://stackoverflow.com/questions/35815615/how-to-make-スクロール可能なタブインアンドロイド –
TabHostまたはTabLayoutを使用してこれを実現します。ただし、このためにRecyclerViewは使用しないでください。 –