【问题标题】:How to remove the border around the toolbar?如何去除工具栏周围的边框?
【发布时间】:2016-11-17 00:02:58
【问题描述】:

在我的应用程序中,我使用了一个工具栏,它周围似乎有一些我想去掉的边框:

我是这样创建的:

<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="wrap_content"
        android:gravity="center"
        android:layout_gravity="center"
        android:minHeight="?attr/actionBarSize"/>

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

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

我就是这样使用它的:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <include
        layout="@layout/app_bar_main_light"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

而且我从未找到指定此边框的属性或样式。

【问题讨论】:

    标签: android border toolbar android-toolbar


    【解决方案1】:

    我在没有 AppBarLayout 的情况下尝试了它,它正在工作。不要使用 AppBarLayout,直接使用 Toolbar。

    【讨论】:

    • 是的,也适用于我。你知道 AppBarLayout 中的什么使这个“影子”吗?
    • @Axl 对不起,Idk。但是你可以在 Playstore 应用的搜索栏中看到同样的布局,你也可以尝试让它变得漂亮。
    • 是的,它有效,但仅适用于棒棒糖后的设备。应该包括适用于棒棒糖前设备的 appbarlayout。
    【解决方案2】:

    如果@joyl 回答有效,但您仍不想删除您的AppBarLayout,则在 AppBarLayout 中将elevation 设置为 0,如下所示:

    <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp">
    

    【讨论】:

      猜你喜欢
      • 2018-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-20
      • 1970-01-01
      • 1970-01-01
      • 2010-09-08
      相关资源
      最近更新 更多