मेरे पास टैबलाउट में एक खंड xml है। TabLayout CollapsingToolbar लेआउट में है जो TabLayout में Fragments की सामग्री को स्क्रॉल करते समय ध्वस्त हो जाता है। मेरे पास एक टुकड़ा है जहां मुझे रीसाइक्लिंग व्यू के ऊपर टेक्स्टव्यू की आवश्यकता है।NestedScrollview + TextView + RecyclerView
अगर मैं लेआउट नीचे के रूप में this question I asked before से लिया है:
<LinearLayout>
<NestedScrollView
<TextView>
</TextView>
</NestedScrollView>
<View>
</View>
<RecyclerView>
</RecyclerView>
</LinearLayout>
ठीक काम करता है, जब तक कि यह TextView भरता इतनी सारी सामग्री में है या स्क्रीन के सबसे तक ले जाता है, RecyclerView का उपयोग कर समाप्त होता है ध्यान में रखते हुए शेष अंतरिक्ष प्रदर्शित करने के लिए:
|------------------| |<TextView-------->| |<---------------->| |<---------------->| |<---------------->| |<---------------->| |</TextView------->| |<RecyclerView---->| |</RecyclerView--->| |__________________|
तो recyclerview न्यूनतम अंतरिक्ष के साथ छोड़ दिया है देखा जाना चाहिए। यदि टेक्स्टव्यू पूरी स्क्रीन लेता है, तो रीसाइक्लर व्यू बस प्रदर्शित नहीं होता है।
this SO Question से लिया तो लेआउट है:
<FrameLayout>
<NestedScrollView
<TextView>
</TextView>
</NestedScrollView>
<View>
</View>
<RecyclerView>
</RecyclerView>
</FrameLayout>
केवल recyclerView प्रदर्शित करता है और TextView सिर्फ अस्तित्वहीन है।
तो लेआउट है:
<NestedScrollView>
<LinearLayout
<TextView>
</TextView>
<View>
</View>
<RecyclerView>
</RecyclerView>
</LinearLayout>
</NestedScrollView>
TextView बस चलता, RecyclerView या नहीं में सामग्री है या नहीं।
मैं कैसे TextView स्क्रॉल खिड़की के बाहर पर्याप्त recyclerview प्रकट करने के लिए तो स्क्रीन इस से जा सकते हैं हो सकता है:
|------------------| |<TextView-------->| |<---------------->| |<---------------->| |<---------------->| |<---------------->| |</TextView------->| |<RecyclerView---->| |</RecyclerView--->| |__________________|
यह करने के लिए:
|------------------| |<---------------->| |</TextView------->| |<RecyclerView---->| |<---------------->| |<---------------->| |<---------------->| |<---------------->| |</RecyclerView--->| |__________________|
मेरा वर्तमान एक्सएमएल कोड जहां केवल RecyclerView दिखाता है और 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>
यकीन नहीं है, लेकिन match_parent करने और framelayout की ऊंचाई भी wrap_content है recycler देखने के लेआउट ऊंचाई निर्धारित करके की कोशिश तो यह बदलकर कोशिश साथ ही या दोनों –
ठीक है मैंने कोशिश की है, दोनों मैच_पैरेंट पर सेट करें, सब कुछ हुआ था कि RecyclerView एकमात्र दृश्य था जो प्रदर्शित हुआ था। मैं LinearLayout को FrameLayout और उस दिखाई दे रही थी TextView – x10sion
आप तो केवल एक TextView है तुम क्यों nestedscrollview में TextView डाल दिया है केवल दृश्य बदल की कोशिश की? scrollview –