如何使用透明状态栏在全屏显示飞溅活动
问题描述:
我如何显示完整的启动屏幕与背景图片&也我想显示状态栏背景什么活动。如何使用透明状态栏在全屏显示飞溅活动
下面的飞溅活动有完整的形象,它可能会在未来的变化,现在我做了iugaad来显示状态栏背景,但每当我改变我的图像状态栏背景应该该图像。
答
你需要做下面的步骤,
V21/styles.xml
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorStatusBarColor</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<!--Required Api 21 above-->
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
注:上方添加样式而不V21代码styles.xml
应用该样式在AndroidManifest.xml
为'安卓主题
android:theme="@style/AppTheme.NoActionBar">
现在只需前往活动&添加下面的代码行中onCreate
方法,
private Window mWindow;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
mWindow = getWindow();
mWindow.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
运行现在&输出会喜欢这个,
+0
它的工作原理!你把它表达得很透明;)赞成盟友。 –
你可以参考此链接(https://*.com/questions/29907615/android-transparent-status-bar-and-actionbar) –
啊很大,让我检查 –