问题
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);
回答1:
Use selector for custom buttons. Search in google for more examples. Here is one.
来源:https://stackoverflow.com/questions/15717356/how-to-highlight-a-menu-item-on-selection