मेरे पास एक रीसाइक्लिंग व्यू है जो गतिशील सामग्री प्रदर्शित करता है। मैं इस रीसाइक्लिंग व्यू को अन्य दृश्यों के बीच प्रदर्शित करना चाहता हूं। उदाहरण के लिए, एक दृश्य के ऊपर और एक दृश्य RecyclerView नीचे प्रदर्शित दिखाया गया है:ऊपर और नीचे रीसाइक्लर व्यू
View
RecyclerView
View
हालांकि, जो कुछ भी मैं कोशिश काम नहीं लगता है और RecyclerView पूरे स्थान ले रहा है। मेरा मानना है कि समस्या wrap_content issue में निहित है, हालांकि मैंने कुछ सुझाए गए समाधानों की कोशिश की है, जैसे this custom LinearLayoutManager, फिर भी यह मेरी समस्या को ठीक नहीं कर रहा है।
प्रयास:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- AppBar works fine; no issue here -->
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/app_bar_layout">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:layout_collapseMode="pin"/>
</android.support.design.widget.AppBarLayout>
<!-- Not displaying; Tried different views -->
<com.chrynan.taginput.view.TextInputWrapper
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edit_text_container">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edit_text"/>
</com.chrynan.taginput.view.TextInputWrapper>
<!-- Takes up entire screen space -->
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/swipe_refresh">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_view"/>
</android.support.v4.widget.SwipeRefreshLayout>
<!-- Not displaying -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text_view"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
प्रश्न: वहाँ जगह है और इसके बाद के संस्करण एक दृश्य और एक RecyclerView के नीचे एक दृश्य प्रदर्शित करने के लिए कोई तरीका है? यदि हां, तो कैसे? या ListView का उपयोग करना बेहतर है?
या तो क्योंकि मेरे लेआउट उदाहरण मैं दे दी है की तुलना में या RecyclerView साथ ज्ञात बग की वजह से थोड़ा अधिक जटिल है, बस एक layout_weight जोड़ने काम नहीं किया। हालांकि, मैं एक RecyclerView के बजाय एक ListView उपयोग करने का फैसला, और ListView को layout_weight जोड़ने मुझे वांछित प्रभाव देना था। – chRyNaN
ग्रेट उत्तर। यह मेरे लिए ठीक काम किया। – Mythul
उत्कृष्ट सुपर बहुत बढ़िया ...... –