如何突出在选择菜单项? [英] how to highlight a menu item on selection?
本文介绍了如何突出在选择菜单项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何突出在选择菜单项,我试图修改styles.xml的各种属性,如颜色pressedHighlight
, colorActivatedHighlight
等,有没有什么办法,以保持专注,直到有其他项目被选中的菜单项?
AndroidManifest.xml中:
<样式名称=上pressedHighLight父=AppBaseTheme>
<项目名称=机器人:colorActivatedHighlight> @色/在pressed< /项目>
< /风格>
<颜色名称=在pressed父=AppBaseTheme>#FF0000< /彩色>
活动文件:
setTheme(R.style.on pressedHighLight);
解决方案
使用选择的自定义按钮。在谷歌搜索更多的例子。 这里是 之一。
How to highlight menu item on selection, I tried modifying styles.xml with various attributes like colorPressedHighlight
, colorActivatedHighlight
, etc. Is there any way to keep the menu item focussed until other item is selected?
AndroidManifest.xml:
<style name="onPressedHighLight" parent="AppBaseTheme">
<item name="android:colorActivatedHighlight">@color/OnPressed</item>
</style>
<color name="OnPressed" parent="AppBaseTheme">#FF0000</color>
Activity file:
setTheme(R.style.onPressedHighLight);
解决方案
Use selector for custom buttons. Search in google for more examples. Here is one.
这篇关于如何突出在选择菜单项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文