动作条不AppCompat显示 [英] Actionbar not shown with AppCompat

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

问题描述

我向后移植我的应用程序API7与AppCompat并与动作条的问题。

I am backporting my app to API7 with AppCompat and have a problem with the actionbar.

当我使用 FragmentActivity 的动作条上显示我的手机(API18),但与 ActionBarActivity 它显示了由pressing的菜单按钮的optionmenu。

When I use FragmentActivity the actionbar is shown on my phone (API18), but with ActionBarActivity it shows up as the optionmenu by pressing the menubutton.

在与API7模拟器上的动作条是始终显示为optionsmenu。

On the emulator with API7 the actionbar is always shown as an optionsmenu.

任何想法?

推荐答案

使用的compat的名称空间,这样你的菜单项:

Use the compat name space for your menu items like this:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:compat="http://schemas.android.com/apk/res-auto" >
    <item android:id="@+id/action_whatever"
      android:icon="@drawable/ic_action_whatever"
      android:title="@string/whatever"
      compat:showAsAction="ifRoom"  />
</menu>

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

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