Monday 15 August 2011

selecteditem - How to change of selected item in custom Horizontal List View in android -



selecteditem - How to change of selected item in custom Horizontal List View in android -

i using custom horizontal listview, need alter color of clicked item.

here code of xml

<com.meetme.android.horizontallistview.horizontallistview android:id="@+id/hlvcustomlist" android:layout_width="match_parent" android:layout_height="50dp" /> selectedrow = view; //view onitemselectlistner view if (selectedrow != null) { selectedrow.setbackgroundcolor(color.blue); } view.setbackgroundcolor(color.blue);

i have tried code on itemclick not working me.

please suggest me appropriate way this.

try set background horizontallistview

add android:background="@drawable/listviewbackground" , write code in listviewbackground.xml in drawable folder. here i'm changing colors, can seek alter per needs

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:color="#aabbcc"/> <!-- pressed --> <item android:state_activated="true" android:color="#fedcba"/> <!-- selected --> <item android:color="#abcdef"/> <!-- default --> </selector>

android selecteditem onitemclick horizontallist

No comments:

Post a Comment