का उपयोग करते समय व्यूपैगर दिखाई नहीं दे रहा है, मैं डिज़ाइन सपोर्ट लाइब्रेरी के साथ खेल रहा हूं और मुझे एक छोटी सी समस्या आ गई है जो मुझे उम्मीद है कि कोई मेरी मदद कर सकता है।CollapsingToolbarLayout
मैं एक CollapsingToolbar का उपयोग कर रहा हूं जिसमें एक छवि दृश्य है जो पैरालैक्स में ध्वस्त हो जाता है। CollapsingToolbar में, मेरे पास एक TabLayout है जो मेरे ViewPager को स्क्रॉल करना है। मेरा मुद्दा यह है कि ViewPager प्रकट नहीं होता है। यह समस्या तब उत्पन्न होती है जब मैंने अपना ViewPager layout_height match_parent या wrap_content पर सेट किया था। अगर मैं इसे 600 डीपी पर सेट करता हूं, तो समस्या चली जाती है लेकिन फिर दृश्य एक निश्चित लंबाई होने के बाद समाप्त होता है जो बहुत अच्छा नहीं है।
किसी भी मदद की सराहना की जाएगी!
यहाँ मेरी एक्सएमएल
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
>
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
android:src="@drawable/stock_image"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:layout_gravity="top"
/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
उन 'NestedScrollView' और' LinearLayout' को हटाकर समस्या को हल करता है iee 'ViewPager'is अब दिखाई देता है। हालांकि, एक और समस्या उत्पन्न होती है: मैं 'ViewPager' को लंबवत स्क्रॉल नहीं कर सकता हूं इसलिए मैंने उन विचारों को पहले स्थान पर रखा था। इसे ठीक करने के लिए कोई सुझाव? – Adam
@Adam - यदि आपको इसकी आवश्यकता हो तो आप प्रत्येक पृष्ठ पर 'NestedScrollView' जोड़ सकते हैं। – ianhanniballake
आपकी मदद के लिए धन्यवाद। मैंने NestPSVrollViews को ViewPager के आस-पास के बजाय मेरे ViewPager के टुकड़ों में डाल दिया और यह काम किया! – Adam