styles
<style name="ImageTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!--在Android 4.4之前的版本上运行,直接跟随系统主题-->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
styles-v19
<style name="ImageTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
</style>
styles-v21
<style name="ImageTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<!--Android 5.x开始需要把颜色设置透明,否则导航栏会呈现系统默认的浅灰色-->
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
设置app theme:
<application
android:name=".utils.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/ImageTranslucentTheme">