Titanium: How To Hide The Actionbar In A Non-alloy Project?
I have no problem hiding the action bar in an Alloy project. However, how do I do this in a non-Alloy project? I tried this: win.activity.actionBar.hide(); But it doesn't work.
Solution 1:
Via win.activity.actionBar.hide();
you can only hide the Action Bar when your window is finally opened. The main disadvantage is that sometimes you can see the Action Bar for a few milliseconds, because the window is initially created with Action Bar.
Since Titanium SDK 4.2.0 there are 4 predefined themes to hide the Action Bar:
Theme.AppCompat.NoTitleBar
Theme.AppCompat.NoTitleBar.Fullscreen
Theme.AppCompat.Translucent.NoTitleBar
Theme.AppCompat.Translucent.NoTitleBar.Fullscreen
Besides globally setting the theme in TiApp.xml (see Wang Dan's answer) one can hide the Action Bar via theme
property of Ti.UI.Window
.
var win = Ti.UI.createWindow({
// ...
theme: "Theme.AppCompat.NoTitleBar"
});
Note that this is a creation-only property, so win.theme = "Theme.AppCompat.NoTitleBar";
does not work.
Solution 2:
<androidxmlns:android="http://schemas.android.com/apk/res/android"><manifest><applicationandroid:theme="@style/Theme.AppCompat.Translucent.NoTitleBar.Fullscreen"></application></manifest></android>
Add this to TiApp.xml
Post a Comment for "Titanium: How To Hide The Actionbar In A Non-alloy Project?"