简体   繁体   中英

Android pre Lollipop toolbar don't work

I have a drawer menu in devices post LOLIPOP work fine in change colors on title and icon navigation but in devices PRE LOLLIPOP don't work and only display white bar but dont show icon

my toolbar

<FrameLayout  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"
    tools:context=".Users.MenuDrawer">
    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        >

        <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/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/WHITE"
                app:popupTheme="@style/AppTheme.PopupOverlay"
                android:theme="@style/CustomToolbar" />

        </android.support.design.widget.AppBarLayout>

        <include layout="@layout/content_main" />


    </android.support.design.widget.CoordinatorLayout>
</FrameLayout>

and my styles

<style name="CustomToolbar" parent="AppTheme">
    <item name="android:textColorSecondary">@color/BLACK</item>
    <item name="colorPrimary">@color/BLACK</item>
    <item name="actionMenuTextColor">@color/BLACK</item>
    <item name="android:textColor">@color/BLACK</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.ActionBar" >
    <item name="android:textColorSecondary">@color/BLACK</item>
    <item name="colorPrimary">@color/BLACK</item>
</style>

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

My error is in used frame layouts in z index position to mi toolbar in pre lolipop dont work i added this change and work fine

<FrameLayout  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"
    tools:context=".Users.MenuDrawer">
    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        >

        <include layout="@layout/content_main" />

        <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/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/WHITE"
                app:popupTheme="@style/AppTheme.PopupOverlay"
                android:theme="@style/CustomToolbar" />

        </android.support.design.widget.AppBarLayout>




    </android.support.design.widget.CoordinatorLayout>
</FrameLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM