Android actionbar not visible

后端 未结 17 2225
萌比男神i
萌比男神i 2020-12-18 18:23

I am trying to add an option menu in actionbar to my existing app but it is not working. If I create a new project with \"hello world\" default app I can see the button in a

相关标签:
17条回答
  • 2020-12-18 18:37

    For your information, I solved my problem of the actionBar by going on the layout XML file and then pressing on View Option -> Show Layout Decorations.

    Hope it will solve your problem.

    Cheers.

    0 讨论(0)
  • 2020-12-18 18:39

    Spent 3 hours and eventually fixed it! Forget removing android:theme="@style/AppTheme" from your manifest. It makes run-time error. This is how I fixed the problem. Your activity should extend AppCompatActivity instead of Activity.

    0 讨论(0)
  • 2020-12-18 18:41
    getSupportActionBar().show();
    

    Simply paste this code in your java onCreate function.

    0 讨论(0)
  • 2020-12-18 18:42

    Principale extends ActionBarActivity should take care of the issue

    0 讨论(0)
  • 2020-12-18 18:43

    on create of your activity.

    getSupportActionBar().setDisplayShowCustomEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(false);
            customNav = LayoutInflater.from(this).inflate(
                    R.layout.action_bar_customvieew, null);
            getSupportActionBar().setCustomView(customNav);
    
    0 讨论(0)
  • 2020-12-18 18:43

    I had the same problem and I confirm that if you delete android:theme="@style/AppTheme" from AndroidManifest.xml, it will solve your problem.

    0 讨论(0)
提交回复
热议问题