Reputation: 4936
I'm sure this is just a matter of changing some xml layout attribute(s) but I couldn't figure out which one(s). I have a listView containing some items. I'm looking for a way to remove the blue highlighting background that appears on an item when it is clicked.
Upvotes: 0
Views: 388
Reputation: 2188
Try this : add this line in your listview xml code android:listSelector="@android:color/transparent"
or if you want only change the selected item's backgroung color will change and rest will remain unchanged then add some additional code in your adapter getView
method
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) convertView.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
= inflater.inflate(
R.layout.your_list_item, null);
}
if(postion!=SelectedPosition)
{
convertView.setBackgroundColor(default Color); // change color as your wish or set transparent
}
else
{
convertView.setBackgroundColor(Color.argb(125,75,236,90));// change color as your wish or set transparent
}
return convertView;
}
you can add your own logic for changing color . hope it works
Upvotes: 1