Android的菜单图标不显示时

Android的菜单图标不显示时

本文介绍了Android的菜单图标不显示时,API级别高于10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试的东西,在Android的菜单选项..我注意到,菜单图标不显示,如果 targetSdkVersion 大于10 ..

I am trying to test something with menu options in Android.. and I noticed that menu icons are not displaying if the targetSdkVersion is greater than 10..

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
   <item android:id="@+id/about" android:title="@string/about_label"
   android:icon="@android:drawable/ic_menu_info_details" android:alphabeticShortcut="a" />
   <item android:id="@+id/help" android:title="@string/help_label"
   android:icon="@android:drawable/ic_menu_help" android:alphabeticShortcut="h" />
</menu>

我试图调试,我不知道从哪里开始。

I am trying to debug and I am not sure where to start.

推荐答案

与API级别11开始(安卓蜂巢)的Andr​​oid推出了菜单的新概念。设备构建的API级别没有菜单键了。代替表示键后的菜单的是pressed有一个新的UI组件:在动作条。在ActionBar现在显示尽可能多的菜单项作为空间允许,之后创建一个按钮,将显示在一个覆盖中的菜单项的其余部分。

Starting with API Level 11 (Android Honeycomb) Android introduced a new concept for menus. Devices build for that API Level do not have a menu key anymore. Instead of showing a menu after a key is pressed there is a new UI Component: the Actionbar. The Actionbar now shows as much menu items as the space allows and after that creates a button that will show the rest of the menu items in an overlay.

我会假设你正在使用某种形式的主题,为您的活动,prevents的动作条出现,因此没有菜单项可见。另请阅读有关如何支持平板电脑和手机开始先导,以了解如何在新的动作条的作品。

I would assume that you are using some kind of theme for your activity that prevents the Actionbar from appearing and therefore no menu items are visible. Also read the guide on how to support Tablets and Handsets to begin to understand how the new actionbar works.

这篇关于Android的菜单图标不显示时,API级别高于10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:10