Reputation: 483
I need a fullscreen App with actionbar. Following methods can hide notificationbar (the Bar containing batteri, rssi, warnings,..) and Navigation-bar (containing back, Home, list of running Apps). But the area under Navigation-bar is still unusable.
I have tested ideas from following posts
as well as:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoSystemBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowFullscreen">true</item>
</style>
and:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
As I said, The area undes Navigation-bar is not useable
Upvotes: 0
Views: 198
Reputation: 196
You can use Theme.AppCompat.Light.
and place in your view hierarchy a toolbar, if you want one.
The toolbar is the new replacement for the actionbar, check this post: http://android-developers.blogspot.pt/2014/10/appcompat-v21-material-design-for-pre.html
This way the your layout has the full height, even under the toolbar, since now it is just a view in your layout.
Upvotes: 1