动作栏不显示 [英] Action bar does not show

查看:97
本文介绍了动作栏不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在应用程序中实现操作栏.

I tried to implement an action bar in my application.

menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/itemAdd"
        android:showAsAction="ifRoom|withText"
        android:title="ADD">
    </item>
    <item
        android:id="@+id/itemRefresh"
        android:showAsAction="ifRoom|withText"
        android:title="REFRESH">
    </item>
    <item
        android:id="@+id/itemHelp"
        android:title="HELP">
    </item>

</menu>

并创建菜单

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.menu, menu);
        return true;
    }

但是即使minSdkVersion是11,它也不会显示操作栏.这是什么原因?

But it does not show the action bar even if minSdkVersion is 11. What is the reason?

推荐答案

为动作栏活动删除主题 在androidManifest文件中.现在它将起作用...

Remove your theme for your actionbar activity in androidManifest file. Now it will work...

<application
    android:allowBackup="true"
    android:icon="@drawable/tasktodo"
    android:label="@string/app_name"
    >

请勿在您的应用清单文件中添加任何主题.如果添加了一个,请删除并尝试运行它.

Don't add any theme in your application manifest file. If you added one, please remove and try running it...

这篇关于动作栏不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆