Friday, March 28, 2014

android4.0 button in the menu, like how to get the focus, show a different picture loses focus


 
menu.xml file:


android: showAsAction = "always"
android: title = "@ string / favorite_manager"
android: icon = "@ drawable / ic_fm_list"
style = "@ style / style_fm_list" / / custom styles in order to achieve press bounce display different images
/>


style.xml file style_fm_list:




Show xml_btn_fm_list.xml file contains different states under different picture:


android: state_focused = "true"
android: state_pressed = "false"
android: drawable = "@ drawable / ic_fm_list" />
android: state_focused = "true"
android: state_pressed = "true"
android: drawable = "@ drawable / ic_fm_list_press" />
android: state_focused = "false"
android: state_pressed = "true"
android: drawable = "@ drawable / ic_fm_list_press" />
android: drawable = "@ drawable / ic_fm_list" />


With this method, the effect did not reach. Before using this method it can ImageButton. Menu does not know why not, I ask how to achieve?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
The original menu:


android: showAsAction = "always"
android: title = "@ string / favorite_manager"
android: icon = "@ drawable / ic_fm_list"
style = "@ android: style / Widget.Holo.ActionButton.Overflow" / / original style, press the blue background
/ / Style = "@ style / style_fm_list" / / custom styles in order to achieve pop show different pictures
Press/>

However, this method does not change, not realized. Anyway modify the menu file, no effect
Reply:
Nobody modified menu yet? Achieve like button, pressing, bouncing with the xml file shows a different picture.
Try the original style = "@ android: style / Widget.Holo.ActionButton.Overflow" into their
style = "@ style / style_fm_list" useless. Which has to change, please advice, thank you!
Reply:
lz can reference Popupwindow menu functions to achieve, you can achieve the desired effect
lzSpecific Cases have.
Reply:
Thank you, 3rd floor, mainly do not want to modify the source code too, would like to modify the existing foundation, this demand is FM module, all modifications only this module. Does not affect the other. Can be modified by style or other documents?
Reply:
By custom theme, the background color removed, popupMenu when clicking a button or click the space outside, popupMenu disappeared, but the picture did not change over.
How to Get popupMenu pop or hidden state? According to the state needs to show a different image effects
Reply:
How to Get popupMenu pop or hidden state? This need to click operation status display to display a different image
Reply:
1,
@ style / Widget.ActionButton.Overflow

2,


3,
ic_menu_moreoverflow.xml





Reply:
Where a complete little

No comments:

Post a Comment