I have an xml snippet in TabLayout. TabLayout is located in the CollapsingToolbar layout, which collapses when scrolling the contents of fragments in TabLayout down. I have one snippet where I need a TextView over a recyclerView.
If I have a layout as shown below, this question I asked before :
<LinearLayout> <NestedScrollView <TextView> </TextView> </NestedScrollView> <View> </View> <RecyclerView> </RecyclerView> </LinearLayout>
It works fine, until the TextView has so much content that it fills or occupies most of the screen, the RecyclerView ends up using the remaining space in the displayed view:
|------------------| |<TextView-------->| |<---------------->| |<---------------->| |<---------------->| |<---------------->| |</TextView------->| |<RecyclerView---->| |</RecyclerView--->| |__________________|
In this way, recyclerview stays with minimal viewing space. If the Textview is full screen, recyclerView just doesnโt appear.
Taken from this QUESTION ... If the layout:
<FrameLayout> <NestedScrollView <TextView> </TextView> </NestedScrollView> <View> </View> <RecyclerView> </RecyclerView> </FrameLayout>
Only recyclerView screens are displayed, and the TextView is simply missing.
If the layout:
<NestedScrollView> <LinearLayout <TextView> </TextView> <View> </View> <RecyclerView> </RecyclerView> </LinearLayout> </NestedScrollView>
TextView simply shows if there is content in RecyclerView or not.
How can I scroll the TextView window enough to show recyclerview so the screen can jump from this:
|------------------| |<TextView-------->| |<---------------->| |<---------------->| |<---------------->| |<---------------->| |</TextView------->| |<RecyclerView---->| |</RecyclerView--->| |__________________|
:
|------------------| |<---------------->| |</TextView------->| |<RecyclerView---->| |<---------------->| |<---------------->| |<---------------->| |<---------------->| |</RecyclerView--->| |__________________|
My current XML is where only RecyclerView is displayed, not TextView:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout 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="wrap_content" android:background="@color/white" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <TextView android:id="@+id/item_shipping_shipping_description" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="start|left" android:padding="@dimen/margin_16" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </android.support.v4.widget.NestedScrollView> <View android:id="@+id/line43" android:layout_width="match_parent" android:layout_height="@dimen/line_height" android:background="@color/light_gray" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </LinearLayout> <android.support.v7.widget.RecyclerView android:id="@+id/item_shipping_fragment_recyclerview" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </FrameLayout>