0
我已經創建了一個自定義列表視圖,但是當我按下一個項目時,我沒有按下的默認樣式應用於特定的行項目。如何取消激活列表視圖的按下樣式
之前式壓(默認):按下後
風格(按下):我自定義列表視圖的
代碼:
ListView list = (ListView) findViewById(android.R.id.list);
String items[] = {"cat", "dog", "horse"};
list.setAdapter(new myAdapter(items));
現在我怎樣才能刪除這些ora幾個地區?通過code
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@android:color/transparent"/>
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_light" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@color/transparent" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@color/transparent" />
<item android:state_focused="true" android:drawable="@drawable/list_focused_holo" />
然後設置:
您是否完全想要停用突出顯示或只是擺脫角落處的邊緣? – Skynet
@PirateCube。完全停用 –
請參閱此處:http://stackoverflow.com/questions/6237120/android-disable-listview-selection – Skynet