I have an activity that goes to another full screen activity. However, when transitioning from this activity to my full screen activity, the navigation bar slides down instead of disappearing instantly. I've inflated a full-screen window in the second activity, but because of the slow sliding animation, it resizes 1 second later after the animation has completed instead of being inflated to full-screen immediately. Therefore, I need the animation to disappear instantly. I've tried
<item name="android:windowAnimationStyle">@null</item>
and
overridePendingTransition(0, 0);
and
Transition fade = new Fade();
fade.excludeTarget(android.R.id.navigationBarBackground, true);
getWindow().setEnterTransition(fade);
with no luck.
On the Windows side, I've tried
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
WindowManager.LayoutParams.FLAG_FULLSCREEN
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
How I hide the navbar: View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
I think, I nailed it:
FullscreenActivity
class:
public class FullscreenActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
decorView.setSystemUiVisibility(uiOptions);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
setContentView(R.layout.activity_fullscreen);
}
}
Manifest:
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_fullscreen"
android:theme="@style/FullscreenTheme"/>
Styles:
<style name="FullscreenTheme" parent="AppTheme">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">@null</item>
<item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
<item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
NB! Setting StatusBar
colour required API 21. For the older versions, to "hide" StatusBar, you need use:
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
as uiOptions in the code above. (it'll cause quite quick resizing, though).
I hope, it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With