android - How to highlight ImageView when focused or clicked? -


a example of either on twitter launch screen (the screen large icons seen when application first launch) or @ application tray when focus application icon.

basically need highlight imageview highlight contours image within imageview , looks it's border image. customize highlight have color , fade out.

thanks,

groomsy

you need assign src attribute of imageview state list drawable. in other words, state list have different image selected, pressed, not selected, etc. - that's how twitter app it.

so if had imageview:

<imageview style="@style/titlebarlogo"             android:contentdescription="@string/description_logo"             android:src="@drawable/title_logo" /> 

the src drawable (title_logo.xml) this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/title_logo_pressed"/>     <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/title_logo_pressed"/>     <item android:state_focused="true" android:drawable="@drawable/title_logo_selected"/>     <item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/title_logo_default"/> </selector> 

the google io schedule app has example of this.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -