alle! Ich habe ein Fragment im FrameLayout-Container innerhalb der Aktivität, die Navigationsschublade hat. Fragment hat TabLayout. Und das Problem ist, wie Sie sehen können, dass die Symbolleiste Schatten auf Fragment TabLayout ablegt. Ich möchte TabLayout nicht in das AppBar-Layout von Activity einfügen, da ich keinen Zugriff auf das Fragment habe und das TabLayout sonst nirgendwo benötigt.Toobar wirft Schatten auf TabLayout
Das ist mein activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/mainNavigationView"
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" />
Und das ist app_bar_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/loginToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/mainFragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Dies ist fragment_by_day_schedule.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="@+id/byDayTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabBackground="?attr/colorPrimary"
app:tabMode="scrollable" />
<android.support.v4.view.ViewPager
android:id="@+id/byDayViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
ich auch die Toolbar ausblenden möchten, wenn ich die Liste nach oben in Fragment innerhalb ViewPager
Haben Sie irgendwelche Ideen wie kann ich das erreichen?
Was macht Sie denken, Sie keinen Zugriff auf die tablayout aus dem Fragment haben, wenn Sie es in der Symbolleiste setzen? Ehrlich gesagt, ich denke, es ist ein viel besseres und weit verbreiteteres Muster, die Registerkarten in der Symbolleiste zu haben. Sie können auch erreichen, dass die Werkzeugleiste ausgeblendet wird, wenn Sie den Viewpager nach oben bewegen. – gaara87
Überprüfen Sie meine Antwort erneut. Ich habe für deine zweite Frage aktualisiert. –