Which is the correct way to remove the action bar inside an activity ?
My activity extends org.holoeverywhere.app.Activity
I've a custom Application class that extends org.holoeverywhere.app.Application and at startup execs this static code :
ThemeManager.setDefaultTheme(ThemeManager.DARK);
ThemeManager.map(ThemeManager.DARK, R.style.Holo_Demo_Theme);
ThemeManager.map(ThemeManager.LIGHT, R.style.Holo_Demo_Theme_Light);
ThemeManager.map(ThemeManager.MIXED, R.style.Holo_Demo_Theme_Light_DarkActionBar);
ThemeManager.map(ThemeManager.DARK | ThemeManager.FULLSCREEN, R.style.Holo_Demo_Theme_Fullscreen);
ThemeManager.map(ThemeManager.LIGHT | ThemeManager.FULLSCREEN, R.style.Holo_Demo_Theme_Light_Fullscreen);
ThemeManager.map(ThemeManager.MIXED | ThemeManager.FULLSCREEN, R.style.Holo_Demo_Theme_Light_DarkActionBar_Fullscreen);
in my activity :
protected void onCreate(Bundle savedInstanceState) {
ThemeManager.removeTheme(this);
setTheme(ThemeManager.DARK | ThemeManager.FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
if I add requestWindowFeature(Window.FEATURE_NO_TITLE)
in the code, on an android 4.1.1
-table- the bar is removed
while on an handset -android 2.3.3
- the bar is not removed.
Before introducing holoeverywhere everything worked fine with just requestWindowFeature(Window.FEATURE_NO_TITLE).
Which is the correct way to remove at runtime the actionbar in holoeverywhere ? (I want to do it at runtime because the user has the option to set a DARK or LIGHT layout, with a DARK default)
See flag ThemeManager.NO_ACTION_BAR. Or just call
getSupportActionBar().hide();
You can do it programatically:
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class ActivityName extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// remove title
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
Or you can do it via your AndroidManifest.xml file:
<activity android:name=".ActivityName"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
</activity>
I added some lines so that you can show it in fullscreen, as it seems that's what you want.
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