java - Removing Title Bar on Android App -


so know there ton of these questions, every time try say, app not seem remove title bar. have done style change:

<style name="apptheme" parent="theme.appcompat.light.darkactionbar">     <!-- customize theme here. -->     <item name="colorprimary">@color/colorprimary</item>     <item name="colorprimarydark">@color/colorprimarydark</item>     <item name="coloraccent">@color/coloraccent</item>     <item name="android:windownotitle">true</item>   <!-- should work not --> </style> 

i have tried:

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     getsupportactionbar().hide(); //this guy here     setcontentview(r.layout.activity_title); 

the above works still want use space title bar takes content in app, why want able modify xml code rather use java. suggestions?

you can either:

<style name="noactionbar">     <item name="windowactionbar">false</item>     <item name="windownotitle">true</item> </style> 

and in layout(at root layout)

android:theme="@theme/noactionbar" 

or

    requestwindowfeature(window.feature_no_title);     getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,         windowmanager.layoutparams.flag_fullscreen); 

however, last 1 hides statusbar. can set theme default theme(look through themes , find noactionbar). last 1 useful if have no plans style activity(for instance if use surfaceview) custom colors, etc.

for instance can change appbasetheme have parent holo.light.noactionbar or similar theme, name has contain noactionbar, othervise has actionbar


Comments