按下后更改菜单颜色
所以我可以毫无问题地更改选项菜单项的颜色。但是,我想将按下时菜单项闪烁的颜色从绿色更改为橙色。我到处看都没有这方面的内容。请帮忙。
So I can change the color of a options menu item no problem. However, I would like to change the color that menu items flash when pressed from green to orange. Everywhere I look has nothing on this. Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望在手指按下按钮时更改菜单项的颜色,然后在实际释放按钮之前,您可能需要查看 onKeyDown() 事件处理程序。在该处理程序中,我将更改菜单项的颜色,然后在 onKeyUp() 处理程序中将颜色改回来。
然而,可能有一种更优雅的方式来处理这个问题。您可以访问 Android SDK UI 事件处理程序页面了解更多信息。
If you want it to change the color of the menu item while having your finger pressed down on the button, before actually releasing it, you likely want to look into an onKeyDown() event handler. In that handler, I would change the color of the menu item, and then in the onKeyUp() handler, change the color back.
There might be a more elegant way of handling this, however. You can visit the Android SDK UI Event Handlers page for more information.