How to change the focus color in the list in the settings?

First take a look at the picture below:

enter image description here

I already changed the background color in the text color via @styles, similar to this

<style name="PreferenceTheme"> <item name="android:background">#000000</item> <item name="android:textColor">#FFFFFF</item> </style> 

In my application, I want to change the focus color (when scrolling with an optical mouse). How can I do it? I want to change this color in the settings (for example, here in the pic.).

+4
source share
2 answers

You can use the android: listSelector = "@android: color / transparent" property in xml.

Example:

  <ListView android:id="@+id/mainListView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:listSelector="@color/white"> </ListView> 

Even

 android:listSelector="@drawable/list_selector" 

also works i think

+3
source

Use setOnItemClickListener something like this:

 YourListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { arg1.setBackgroundColor(Color.BLUE); } }); 
+1
source

All Articles