【问题标题】:How I can remove shadow or divider from bottom of AppBar layout or Toolbar?如何从 AppBar 布局或工具栏的底部移除阴影或分隔线?
【发布时间】:2019-11-12 18:17:26
【问题描述】:

我想从 AppBar 布局或工具栏的底部移除阴影或分隔线

这是我的xml代码

elevation,actionBarDivider 已经试过了。

<com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:elevation="0dp"
            android:theme="@style/AppTheme.AppBarOverlay">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimaryDark"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

 </com.google.android.material.appbar.AppBarLayout>

【问题讨论】:

  • 可能重复。看到这个stackoverflow.com/questions/34527721/…
  • @AslamHossin 请按上述检查并在代码中显示我已经尝试过此解决方案。
  • android:elevation="0dp" 将替换为 app:elevation="0dp"

标签: android android-layout android-toolbar android-appbarlayout


【解决方案1】:

设置海拔 0(零)dp(例如:android:elevation="0dp" 或 app:elevation="0dp"),如下所示:

<com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp"
            android:theme="@style/AppTheme.AppBarOverlay">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimaryDark"
                app:popupTheme="@style/AppTheme.PopupOverlay"
                 />

 </com.google.android.material.appbar.AppBarLayout>

【讨论】:

  • 在 AppBarLayout 中尝试 app:elevation="0dp" 而不是 android:elevation="0d"。
猜你喜欢
  • 2016-04-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多