这是一个梯度被用作scrim。要实现这种效果,首先必须删除状态栏和导航栏的半透明底层。 Another answer详细说明如何在较低的平台设备上执行此操作;但在Android棒棒糖或更高版本,你可以简单地通过设置两个样式做这个属性透明:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme" parent="android:Theme.Material.Wallpaper.NoTitleBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>
然后,添加网格布,你可以使用一个形状绘制:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:type="linear"
android:angle="270"
android:centerY="0.3"
android:startColor="#66000000"
android:centerColor="#33000000"
android:endColor="#00000000"/>
</shape>
然后你可以只设置这个为背景,以一个View
在布局:
<View
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/scrim"/>
您还可以设置android:rotation="180"
属性使用相同的梯度个底部e屏幕。
不与旧的操作系统选项去,看来你添加一个旧的操作系统选项 –
你是不是指“的minSdkVersion”或“targetSdkVersion '? ....我在Android 6.0设备上测试,谷歌现在的屏幕截图也来自同一设备...我在我的示例应用程序中提到了minSdkVersion为21,targetSdkVersion为23 –