Mohammad Ersan
Mohammad Ersan

Reputation: 12444

change the look of Gallery selected item

i have "Gallery" on my layout, and i created a class inherits from BaseAdapter, to set it as Gallery adapter

GalleryAdapter extends BaseAdapter 

and i used it

setAdapter(new GalleryAdapter

and it works fine.

but now i need to change the selected view within the gallery, i need it within the adapter.

is there anyway to know if this "View" is selected from the Adapter so i can change the look of it?

Upvotes: 1

Views: 2645

Answers (1)

dmon
dmon

Reputation: 30168

The easiest way to do this is to create a statelist drawable (see here) and customize the "selected" state to whatever you want there. Then you provide this drawable as the background for the item.

Upvotes: 3

Related Questions