不能证明与AppCompat库项目 [英] Couldn't show items with AppCompat library

查看:191
本文介绍了不能证明与AppCompat库项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些麻烦,以显示与AppCompat的动作条的项目。

I am having some troubles to show items in the ActionBar with AppCompat.

这code工作在一个正常的动作条​​

This code works on a normal actionbar

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/item1"
        android:showAsAction="always"
        android:title="Se connecter"
        android:visible="true">
    </item>

</menu>

但随着AppCompat库中的项目不显示。

But with the AppCompat library the item isn't shown..

我应该怎么办?

在此先感谢:)

推荐答案

showAsAction 不是在android XML命名空间API&LT; 11尝试类似如下:

showAsAction is not in the android xml namespace for API < 11 try something like the following:

<menu xmlns:android="http://schemas.android.com/apk/res/android" 
  xmlns:yourapp="http://schemas.android.com/apk/res-auto">

<item android:id="@+id/action_refresh"
    android:title="@string/refresh"
    yourapp:showAsAction="always"
    android:icon="@drawable/ic_action_refresh" />
</menu>

请注意,我已经增加的xmlns:yourapp =htt​​p://schemas.android.com/apk/res-auto 菜单中的属性和改变的空间 showAsAction 机器人 yourapp <​​/ code>。

Note that I've added xmlns:yourapp="http://schemas.android.com/apk/res-auto in menu attributes and changed the namespace of showAsAction from android to yourapp.

更多阅读这里:<一href="http://developer.android.com/guide/topics/ui/actionbar.html">http://developer.android.com/guide/topics/ui/actionbar.html

这篇关于不能证明与AppCompat库项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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