मैं अपने खराब कोड और बुरे ज्ञान के लिए पहले से माफ़ी मांगता हूं। मैंने हाल ही में एंड्रॉइड और जावाव्यूपार्ज टैब फ्रैगमेंट और सामान्य टुकड़े
में कोडिंग शुरू कर दी है मेरी समस्या यह है कि मेरे पास नेविगेशन ड्रॉवर और टैब हैं। हालांकि अगर मैं नेविगेशन ड्रॉवर से कुछ चुनता हूं जो एक टुकड़े में लोड होता है तो यह नहीं दिखाता है। केवल टैब दिखा रहे हैं।
मेरी योजना यह है कि एक नेविगेशन ड्रॉवर टैब में 3 टैब होंगे और बाकी टैब के बिना सामान्य पृष्ठ होंगे।
MainActivity.java
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<FrameLayout
android:id="@+id/fragment_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000" />
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
app_bar_main.xml
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="se.themeister.hello.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:background="?attr/colorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/AppTheme.AppBarOverlay"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#009900"
android:layout_below="@id/tab_layout"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
मुझे लगता है कि यदि पर्याप्त नहीं जानता जाने या अधिक जानकारी या कोड आवश्यक है
मैं भी एक ही दृष्टिकोण निम्नलिखित किया गया है लेकिन इसमें भी एक दोष यह है कि मैं भी देख रहा हूँ है ठीक करने के लिए। आदर्श रूप से 'टूलबार' और 'टैबलाउट' में एक ही रंग होना चाहिए लेकिन ऊपर के दृष्टिकोण का उपयोग करके 'टैबलाउट' और 'टूलबार' के बीच छाया होगी जो आदर्श नहीं है। – Sharj