【问题标题】:Toolbar disappears when adding app:elevation attribute添加 app:elevation 属性时工具栏消失
【发布时间】:2017-10-23 03:41:09
【问题描述】:

我希望我的 AppCompat 工具栏透明且高度为零。

添加android:background属性使工具栏透明,但添加app:elevation属性只会使工具栏完全消失;向上按钮和标题消失,如果背景是红色或其他纯色,该颜色也会消失。

知道为什么吗?

这是我的 AppBar

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:background="@android:color/transparent"
    app:elevation="0dp"
    >

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:layout_collapseMode="pin"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"


        />

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

【问题讨论】:

标签: android


【解决方案1】:

你只需要在java文件中写findViewById(R.id.appBar).bringToFront();。 希望对你有帮助?

【讨论】:

    猜你喜欢
    • 2015-08-07
    • 2018-09-18
    • 1970-01-01
    • 2016-06-09
    • 2016-04-13
    • 2012-04-18
    • 1970-01-01
    • 1970-01-01
    • 2017-06-15
    相关资源
    最近更新 更多