Android ActionBar is hidden with DroidGap (PhoneGap/ Cordova)

别说谁变了你拦得住时间么 提交于 2019-12-04 19:59:02

I solved my problem:

My RegisterActivity extends the Class Activity! My MainActivity extends the class DroidGap from Phonegap2.5.0 (aka Apache Cordova).

I changed MainActivity so that it extends Activity and the result is that the ActionBar is visible :D

When you need DroidGap you will have to insert

super.setBooleanProperty("showTitle", true);

before you call:

super.onCreate(savedInstanceState);

At the end it looks like this:

public class MainActivity extends DroidGap {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.setBooleanProperty("showTitle", true);
    super.onCreate(savedInstanceState);
//More Code ....

The correct way of setting the boolean property ShowTitle is using the preferences in the config.xml.

add

<preference name="ShowTitle" value="true"/>

to config.xml to enable the ActionBar on Android.

Are you sure that there is no line:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

in onCreate() method?

Try:

public void onCreate(Bundle savedInstanceState) {
        this.requestWindowFeature(Window.FEATURE_ACTION_BAR);
        super.onCreate(savedInstanceState);
        ...
        setContentView(...);
        ...

or

...
this.requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!