问题描述
我想通过添加< item name =android:statusBarColor> @android:color / transparent< / item>
使状态栏变得透明到样式名称=AppTheme.NoActionBar
上的v21 / styles.xml但是我一直在应用栏上方留下阴影,是否可以将其删除?
I'd like to make the status bar transparent by adding <item name="android:statusBarColor">@android:color/transparent</item>
to v21/styles.xml on style name="AppTheme.NoActionBar"
but I keep getting a shadow above the app bar, is it possible to remove it?
编辑:
好的我认为解决方案是移动应用栏占据状态栏空间并扩展额外dp的应用栏以匹配它的大小所以我的问题是,是否可以向上移动或延长应用栏高度?
Ok I think the solution is to move the app bar occupying the status bar space and extending the app bar of an additional dp to match it size so my question is, is it possible to move or extend the app bar height upwards?
activity_search.xml
activity_search.xml
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/MyMaterialTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
app:popupTheme="@style/MyMaterialTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_search"/>
推荐答案
我相信这个问题指的是同样的问题
I believe this question is pointing to same problemAndroid appbarlayout elevation appears in status bar
您的根布局应始终具有 android:fitsSystemWindows =true
,否则您的UI不会在状态栏后面绘制。
Your root layout should have android:fitsSystemWindows="true"
at all times, otherwise your UI will not draw behind status bar.
现在将 AppBarLayout
包装在另一个 CoordinatorLayout
哪个
Now wrap the AppBarLayout
inside another CoordinatorLayout
which has
android:fitsSystemWindows =false
。
这样可以防止阴影溢出到状态栏。
这篇关于如何删除应用栏上方的阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!