2014-11-04 82 views
1

我一直在試圖禁用ExpandableListView中的高亮顯示。我嘗試將下一個drawable設置爲背景,但這不起作用。在ExpandableListView中禁用高亮顯示

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

<item android:drawable="@color/_GREY_Weak"/> 

<item android:drawable="@color/_GREY_Weak" 
    android:state_pressed="true" /> 

<item android:drawable="@color/_GREY_Weak" 
    android:state_selected="true" /> 

<item android:drawable="@color/_GREY_Weak" 
    android:state_focused="true" /> 

<item android:drawable="@color/_GREY_Weak" 
    android:state_checked="true" /> 

<item android:drawable="@color/_GREY_Weak" 
    android:state_long_pressable="true" /> 

<item android:drawable="@color/_GREY_Weak" 
    android:state_hovered="true" /> 

<item android:drawable="@color/_GREY_Weak" 
    android:state_expanded="true" /> 
</selector> 

我試着設置每個狀態可繪製爲那種顏色,@null或透明,但仍然是相同的。以下是我的問題的一些截圖。我想像父母一樣擺脫孩子們的焦點。

enter image description here

enter image description here

我也triead設置在沒有運氣ExpandableListView XML屬性drawingCacheHint。

+1

橙色突出顯示效果是ExpandableListView上的一種樣式。您需要重寫ExpandablelistView樣式。你有沒有嘗試過android:listSelector =「@ android:color/transparent」在ExpandableListView xml – Wildroid 2014-11-04 20:31:32

+0

謝謝你做的伎倆!如果你想發表你的評論作爲答案,所以我可以檢查它是有用的。 – 4gus71n 2014-11-05 11:40:48

+0

很高興工作。我發佈了答案。 – Wildroid 2014-11-05 12:14:38

回答

5

嘗試ExpandableListView XML

或者覆蓋ExpandableListView風格加入

android:listSelector="@android:color/transparent"