如何更改选项菜单中的索引图标?
我的意思是图标(3)。
下面是我的code:
@覆盖
公共布尔onCreateOptionsMenu(功能菜单){
MenuInflater充气= getMenuInflater();
inflater.inflate(R.menu.options,菜单);
返回true;
}
这里是XML文件:
<项目机器人:ID =@ + ID /错误报告
机器人:标题=@字符串/ option_bugreport/>
<项目机器人:ID =@ + ID /信息
机器人:标题=@字符串/ option_info/>
<项目机器人:ID =@ + ID /关于
机器人:标题=@字符串/ option_about/>
解决方案
<! - 应用主题。 - >
<样式名称=AppTheme父=AppBaseTheme>
<! - 所有的定制,这不是针对特定的API级别的可以去这里。 - >
<项目名称=机器人:actionOverflowButtonStyle> @风格/ MyActionButtonOverflow< /项目>
< /风格>
<! - 样式更换动作条上溢图标。设置项目'机器人:actionOverflowButtonStyle在AppTheme - >
<样式名称=MyActionButtonOverflow父=机器人:款式/ Widget.Holo.Light.ActionButton.Overflow>
<项目名称=机器人:SRC> @可绘制/ ic_launcher< /项目>
<项目名称=?机器人:背景>机器人:ATTR / actionBarItemBackground< /项目>
<项目名称=机器人:contentDescription>中拉拉< /项目>
< /风格>
这是它如何可以做到的。如果你想改变操作栏上溢图标
How to change the index icon of option menu?
I mean icon (3).
Here is my code:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options, menu);
return true;
}
And here is the XML file:
<item android:id="@+id/Bugreport"
android:title="@string/option_bugreport" />
<item android:id="@+id/Info"
android:title="@string/option_info" />
<item android:id="@+id/About"
android:title="@string/option_about" />
解决方案 <!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>
<!-- Style to replace actionbar overflow icon. set item 'android:actionOverflowButtonStyle' in AppTheme -->
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">
<item name="android:src">@drawable/ic_launcher</item>
<item name="android:background">?android:attr/actionBarItemBackground</item>
<item name="android:contentDescription">"Lala"</item>
</style>
This is how it can be done. If you want to change the overflow icon in action bar
上一篇:Android的设置多个闹钟多个、闹钟、Android
下一篇:ListView中随机抛出IndexOutOfBoundsException上升级Froyo抛出、ListView、Froyo、IndexOutOfBoundsException