如何将AppBarLayout的高程设置为0

时间:2015-12-30 10:33:07

标签: android toolbar android-support-library

我的布局文件如下:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout        xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
...
android:elevation="0dp"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="256dp"
    android:fitsSystemWindows="true"
    android:elevation="0dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:elevation="0dp"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginEnd="50dp"
        app:expandedTitleMarginStart="50dp"
        app:titleEnabled="false"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <android.support.v7.widget.Toolbar
            android:id="@+id/main_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:elevation="0dp"
            app:layout_collapseMode="pin"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

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

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


<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerview_worthiness_detail"
    ...
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

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

<com.yidoutang.app.widget.DetailAvatarView
    android:id="@+id/iv_header_worthiness_detail"
    android:layout_width="@dimen/header_size_datail"
    android:layout_height="@dimen/header_size_datail"
    android:clickable="true"
    android:elevation="0dp"
    app:backgroundTint="@color/fab_color_primary"
    app:border_color="@color/white"
    app:border_width="1dp"
    app:layout_anchor="@id/appbar"
    app:layout_anchorGravity="bottom|center_horizontal"
    app:layout_behavior="com.yidoutang.app.widget.behavior.AvatarBehavior"
    app:rippleColor="@android:color/darker_gray" />

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

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

我设置了android:elevation =&#34; 0dp&#34; to Toorbar,CoordinatorLayout和AppBarLayout,但当它关闭时,它仍然有高程。

像图像

enter image description here

如何删除elavation?

3 个答案:

答案 0 :(得分:30)

使用app:elevation="0dp"删除海拔

答案 1 :(得分:26)

而不是

android:elevation="0dp"

app:elevation="0dp"

答案 2 :(得分:0)

__LO(x)更改为android对您有用。

app