when set app:elevation=“0dp” then hamburgermenu not showing to toolbar

僤鯓⒐⒋嵵緔 提交于 2019-11-26 21:50:35

问题


Hi I wanted to remove the below shadow of toolbar for that I have used elevation property, Currently my code is

<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:background="@color/transparent">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"

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


    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


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

and the output is:-

here I dont want the below shadow so I set

    app:elevation="0dp" 

to AppBarLayout, then it removes the shadow but the HamburgerMenu disappeared. the new output is as below:-

Can anybody tell me how do I remove the shadow without hiding/disappearing HamburgerMenu .


回答1:


try this:

    <android.support.design.widget.AppBarLayout
            android:id="@+id/appBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp">
            ...
</android.support.design.widget.AppBarLayout>

then in your activity;

findViewById(R.id.appBar).bringToFront();


来源:https://stackoverflow.com/questions/41931245/when-set-appelevation-0dp-then-hamburgermenu-not-showing-to-toolbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!