这是它的外观:
这是应该如何:
activity_main.xml中
<androID.support.v4.Widget.DrawerLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:app="http://schemas.androID.com/apk/res-auto"xmlns:tools="http://schemas.androID.com/tools"androID:ID="@+ID/drawer_layout"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:fitsSystemwindows="true"tools:openDrawer="start"><include layout="@layout/app_bar_main" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" /><androID.support.design.Widget.NavigationVIEw androID:ID="@+ID/nav_vIEw" androID:layout_wIDth="wrap_content" androID:layout_height="match_parent" androID:layout_gravity="start" app:headerLayout="@layout/nav_header_main" app:menu="@menu/activity_main_drawer" /></androID.support.v4.Widget.DrawerLayout>
app_bar_main.xml
<?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"xmlns:tools="http://schemas.androID.com/tools"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:fitsSystemwindows="true"tools:context="hu.pe.thinhhoang.aaosync.MainActivity"><androID.support.design.Widget.AppbarLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:theme="@style/Apptheme.AppbarOverlay"> <androID.support.v7.Widget.Toolbar androID:ID="@+ID/toolbar" androID:layout_wIDth="match_parent" androID:layout_height="?attr/actionbarSize" androID:background="?attr/colorPrimary" app:popuptheme="@style/Apptheme.PopupOverlay" /></androID.support.design.Widget.AppbarLayout><include layout="@layout/content_main" /></androID.support.design.Widget.CoordinatorLayout>
styles.xml(v21)
<resources>><style name="Apptheme.NoActionbar"> <item name="windowActionbar">false</item> <item name="windowNoTitle">true</item> <item name="androID:windowDrawsSystembarBackgrounds">true</item> <item name="androID:statusbarcolor">@androID:color/transparent</item></style></resources>解决方法 这个阴影是在LolliPOP下面的API上的windowContentOverlay的一部分(在LolliPOP它是@null).
当您使用工具栏小部件时,工具栏不再是窗口装饰的一部分,所以阴影从工具栏顶部的窗口开始,而不是下方(因此您希望windowContentOverlay为@null).此外,您需要在LolliPOP前面添加一个额外的空视图,其背景设置为垂直阴影可绘制(从#20000000到#00000000的8dp高渐变效果最好).在LolliPOP上,您可以在工具栏上设置8dp高程.
总结以上是内存溢出为你收集整理的Android – 工具栏的阴影在状态栏为棒棒糖全部内容,希望文章能够帮你解决Android – 工具栏的阴影在状态栏为棒棒糖所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)