Reputation:
How do i show full splash screen with background image & also i want to show status bar background what activity has.
Following splash activity has full image it will might be change in future, right now i did iugaad to show that status bar background but whenever i am changing my image status bar background should that image.
Upvotes: 5
Views: 9422
Reputation: 2189
You need to do following steps,
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>
Note: Add above style without v21 code in styles.xml
Apply that style in AndroidManifest.xml
as `android:theme
android:theme="@style/AppTheme.NoActionBar">
Now simply go to your activity & add following line of code in onCreate
method,
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);
}
Run now & output will like this,
Upvotes: 15