मेरे पास एक गतिविधि है जिसमें 3 टैब हैं। प्रत्येक टैब पृष्ठ एक खंड है जो एक RecyclerView प्रदर्शित करता है। खंड में से एक में फ़्लोटिंगएक्शन बटन है। मैं इस बटन को फ्रैगमेंट के लेआउट में कार्यान्वित कर रहा हूं। मैं इसे टुकड़े के निचले दाएं हिस्से में स्थिर बना रहा हूं।ViewPager स्वाइप पर फ़्लोटिंगएक्शन बटन को दिखाएं/छुपाएं
टुकड़ा लेआउट:
- CoordinatorLayout
- RecyclerView
- FAB (without any behavior)
गतिविधि लेआउट में, मेरे पास है:
- CoordinatorLayout
- AppBarLayout
- Toolbar
- TabLayout (SmartTabLayout)
- ViewPager
समस्या अब फैब देखने से आधा छिपा हुआ है है जब टूलबार का विस्तार किया गया है, लेकिन पूरी तरह से जब से पता चला टूलबार ध्वस्त हो गया है। हालांकि यह तब नहीं होता है जब मैं गतिविधि में एफएबी बटन को लागू करता हूं। लेकिन मैं सभी टुकड़ों में बटन नहीं चाहता हूं। मैं इसे केवल पहले टुकड़े में डाल रहा हूँ।
यहां एक स्पष्ट है जिसे मैंने स्पष्ट किया है। गतिविधि लेआउट के लिए
एक्सएमएल:
<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/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/color_primary"
app:layout_scrollFlags="scroll|enterAlways" />
<com.ogaclejapan.smarttablayout.SmartTabLayout
android:id="@+id/viewpagertab"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_height"
android:background="@color/color_primary" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
टुकड़ा लेआउट के लिए एक्सएमएल:
<?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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/card_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_plus_white_48dp"
app:layout_anchor="@id/card_list"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>
मेरा प्रश्न है कैसे मैं इतना कर सकता हूँ बटन दृश्यमान बनी रहती है कि जब recyclerview स्क्रॉल किया है ?
मुझे लगता है कि मैं आपके समाधान का उपयोग कर रहा हूं क्योंकि यह अधिक कार्यक्षमता प्रदान करता है। तुम्हारे सुझाव के लिए धन्यवाद! – AimanB
@AimanB एक और बात, समर्थन डिजाइन लाइब्रेरी के नवीनतम संस्करण का उपयोग करना सुनिश्चित करें, उन्होंने नवीनतम संस्करणों में कई मुद्दों को ठीक किया है, एक 'शो()' और 'hide()' विधियों के साथ दिखाए गए डिफ़ॉल्ट एनिमेशन हैं। –