显示的操作栏的菜单项的图标在蜂巢的Andr​​oid 3.0 [英] Displaying icon for menu items of Action Bar in Honeycomb android 3.0

查看:145
本文介绍了显示的操作栏的菜单项的图标在蜂巢的Andr​​oid 3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我使用的蜂窝的Andr​​oid 3.0开发Android应用程序。我tryig显示在操作栏菜单。菜单上有一个图标和本标题。当我们单击下拉列表的形式,它都会显示其项的菜单项。它在下拉列表项目名称的项目,但与出图标,它显示。我想,当我点击菜单出现在下拉列表中的标题旁将显示一个图标。谁能帮助我在设法解决这个问题。我的XML文件如下:

hi
I am developing an android application using Honeycomb android 3.0 . I am tryig to display a menu in Action Bar . The menu has an icon and tiltle. When we click the menu item it displays its items in the form of a dropdown list .It was the items in drop down list with item names but with out icon it is displaying . I want an icon to be displayed beside the title in drop down list which appears when I click the menu. can anyone help me in sorting out this issue. my xml file is as below:

 <?xml version="1.0" encoding="utf-8"?>           
<menu  xmlns:android="http://schemas.android.com/apk/res/android">  
<item          
  android:id="@+id/addserver"  
  android:icon="@android:drawable/ic_menu_add"   
  android:title="Add Server"    
  android:showAsAction="ifRoom|withText"     
>  

<menu>    
            <item android:id="@+id/fileserver"    
                  android:icon="@android:drawable/ic_menu_add"  
                  android:title="File Server"          
                  android:onClick="onCreate"           
                  android:showAsAction="always"/>      
            <item android:id="@+id/sharepoint"            
                  android:icon="@android:drawable/ic_menu_add"  
                  android:title="Share Point"          
                  android:onClick="onCreate" />          
        </menu>            
</item>

起初,它显示与图标添加服务器上离开了。点击会显示文件服务器,SharePoint中作为下拉列表与出图标,虽然我给出的Andr​​oid:图标声明。
谁能帮我整理出这个问题?
在此先感谢,

Initially it displays add server with icon on left. clicking on that will display fileserver ,sharepoint as dropdown list with out icon though I given android:icon statement.
Can anyone help me in sorting out this issue?
Thanks in Advance,

推荐答案

在哪里图标操作栏的溢出菜单不显示的现象是由设计(在本文写作)。如果您确实需要使用的图标,,你需要编写一个自定义实现考虑重新思考你的设计,以适应用户界面约定。

The behavior where icons are not displayed in the action bar's overflow menu is by design (as of this writing). If you absolutely need to use icons, you'll need to write a custom implementation consider rethinking your design to fit the UI conventions.

这篇关于显示的操作栏的菜单项的图标在蜂巢的Andr​​oid 3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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