3
我如何顯示完整的啓動屏幕與背景圖片&也我想顯示狀態欄背景什麼活動。如何使用透明狀態欄在全屏顯示飛濺活動
下面的飛濺活動有完整的形象,它可能會在未來的變化,現在我做了iugaad來顯示狀態欄背景,但每當我改變我的圖像狀態欄背景應該該圖像。
我如何顯示完整的啓動屏幕與背景圖片&也我想顯示狀態欄背景什麼活動。如何使用透明狀態欄在全屏顯示飛濺活動
下面的飛濺活動有完整的形象,它可能會在未來的變化,現在我做了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);
}
運行現在&輸出會喜歡這個,
它的工作原理!你把它表達得很透明;)贊成盟友。 –
你可以參考此鏈接(https://stackoverflow.com/questions/29907615/android-transparent-status-bar-and-actionbar) –
啊很大,讓我檢查 –