मेरे पास मेरे एप्लिकेशन में एक निचला नेविगेशन बार है और 3 खंड, homefragment
में मैं Collapsing टूलबार जोड़ना चाहता हूं, लेकिन एप्लिकेशन चलाने के बाद मैंने पाया कि स्क्रॉलिंग अंत तक नहीं पहुंचती है जैसा कि छवि में दिखाया गया है यहां चित्र विवरण दर्ज करें
मेरी गतिविधि में_मेन.एक्सएमएल
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="0dp" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@+id/nav_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>
मेरे Home_fragment . में
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ui.home.HomeFragment">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/Theme.TheTestAppByNav.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/Theme.TheTestAppByNav.PopupOverlay" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/large_text" />
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
क्या आप मेरी मदद कर सकते हैं धन्यवाद!
2 जवाब
आप NestedScrollView
के नीचे पैडिंग जोड़ सकते हैं जो BottonNavigationView
की ऊंचाई के बराबर है।
सटीक ऊंचाई 56db है, आप यहां
<dimen name="design_bottom_navigation_height">56dp</dimen>
लेकिन आप नीचे के टेक्स्ट को BottomNavigationView
के ऊपर से चिपकाने से बचने के लिए इसे थोड़ा बढ़ा सकते हैं, यहां मैं 60dp का उपयोग कर रहा हूं
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:paddingBottom="60dp"
tools:showIn="@layout/activity_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/large_text" />
</androidx.core.widget.NestedScrollView>
डेमो:
आप समन्वयक लेआउट को सापेक्ष लेआउट के अंदर लपेट सकते हैं और समन्वयक लेआउट के समानांतर उस सापेक्ष लेआउट में नीचे नेविगेशन ले सकते हैं।
<RelativeLayout>
<android.support.design.widget.CoordinatorLayout>
...
...
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.BottomNavigationView ... />
</RelativeLayout>
संबंधित सवाल
जुड़े हुए प्रश्न
नए सवाल
android
एंड्रॉइड Google का मोबाइल ऑपरेटिंग सिस्टम है, जिसका उपयोग प्रोग्रामिंग या डिजिटल डिवाइस (स्मार्टफोन, टैबलेट, ऑटोमोबाइल्स, टीवी, वियर, ग्लास, IoT) को विकसित करने के लिए किया जाता है। एंड्रॉइड से संबंधित विषयों के लिए, एंड्रॉइड-विशिष्ट टैग जैसे कि एंड्रॉइड-इरादे, एंड्रॉइड-गतिविधि, एंड्रॉइड-एडॉप्टर आदि का उपयोग करें। विकास या प्रोग्रामिंग के अलावा अन्य प्रश्नों के लिए, लेकिन एंड्रॉइड फ्रेमवर्क से संबंधित हैं, इस लिंक का उपयोग करें: https: // android.stackexchange.com।