First please take a look at picture below:
首先请看下面的图片:
I already changed background color in text color via @styles like that
我已经通过@styles改变了文本颜色的背景颜色
<style name="PreferenceTheme">
<item name="android:background">#000000</item>
<item name="android:textColor">#FFFFFF</item>
</style>
In my application i want to change focus color ( when scrolling with optical mouse ). How do i do that? I want to change that color in preferences ( like here on pic ).
在我的应用程序中,我想更改焦点颜色(使用光学鼠标滚动时)。我怎么做?我想在偏好中更改该颜色(如图中所示)。
2 个解决方案
#1
3
You can make use of android:listSelector="@android:color/transparent" property in xml.
你可以在xml中使用android:listSelector =“@ android:color / transparent”属性。
Ex:
<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 guess
我猜也是有效的
#2
1
Use setOnItemClickListener
something like this:
使用setOnItemClickListener这样的东西:
YourListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
arg1.setBackgroundColor(Color.BLUE);
}
});
#1
3
You can make use of android:listSelector="@android:color/transparent" property in xml.
你可以在xml中使用android:listSelector =“@ android:color / transparent”属性。
Ex:
<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 guess
我猜也是有效的
#2
1
Use setOnItemClickListener
something like this:
使用setOnItemClickListener这样的东西:
YourListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
arg1.setBackgroundColor(Color.BLUE);
}
});