I'm building an app using PhoneGap, which calls
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
in the parent onCreate (DroidGap). But, I want to add the title back on so I can use an ActionBar. Is there any flag/way to reset this feature back? If worst comes to worst, I can modify the entire DroidGap class, but would like to still use their version.
And in case it helps anyone to see what DroidGap does in its onCreate, here's the link: https://github.com/phonegap/phonegap-android/blob/master/framework/src/com/phonegap/DroidGap.java
ActionBar code:
super.onCreate(savedInstanceState);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.main);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR); super.init();
ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // here NPE is thrown
bar.addTab(bar.newTab().setText("Some Text").setTabListener(new CustomTabListener()));
Phonegap / Cordova version 1.9 added a flag to toggle this feature:
if(!this.getBooleanProperty("showTitle", false))
{
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}
Example onCreate method that enables window title:
@Override
public void onCreate(Bundle savedInstanceState) {
// enable window title for actionbar support
super.setBooleanProperty("showTitle", true);
super.onCreate(savedInstanceState);
}
Have you tested FEATURE_CUSTOM_TITLE?
getWindow().requestFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setTitle(getResources().getString(R.string.app_name));
or try loading Theme with title bar:
setTheme(android.R.style.choose some of the themes listed or create your own);
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