GAMA
GAMA

Reputation: 5996

Selected item from list getting highlighted

In following list, when I click any item which has width equal to 2 lines (in below eg, CNX SMALLCAP), item gets highlighted appropriately.

Problem comes when I click any item which has width equal to 1 line (in below eg, ICICI BANK), then along with the clicked item half of the above and below item is also getting highlighted.

Highlighting is always using width=2 lines.

What can be done to remove this?

I tried using clearFocus() and clearAnimation() inside onListItemClick() , but no luck.

ANY HELP WILL BE LIFE-SAVER !!!

screen

Upvotes: 0

Views: 163

Answers (2)

Arun
Arun

Reputation: 1668

Since you have two lines, focusing both the lines when you have some content makes sense. Hence make the line which you are not using invisible or gone. You can also create separate custom adapter for your listview with single line.

Upvotes: 2

Pratik
Pratik

Reputation: 30855

I think you set the selected color on the ListView not into the ListView item i.e. TextView which you have display as item. You can either set selected color on TextView or just set the textview background color as #00000000

<TextView android:background="#00000000" />

using this you define the transparency of the textview color with this

Upvotes: 0

Related Questions