2011-08-06 34 views
0

我在帶有白色背景的活動中創建了一個ListView。但是,如果我掃過物品,它們的背景會變黑,並覆蓋文字。我該如何禁用它? listview使用ArrayAdapter來填充它。禁用ListView中的清掃項目

這裏是我的ListView XML:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:background="#F2F2F2"> 
<LinearLayout android:id="@+id/newEntry" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
    <EditText android:id="@+id/txtNewItem" android:layout_width="wrap_content" android:layout_height="fill_parent" android:selectAllOnFocus="true" 
     android:layout_weight="1" android:maxLength="8" android:inputType="numberSigned|numberDecimal"/> 
    <Button android:id="@+id/btnNewItem" android:text="@string/add_item" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="24sp" /> 
</LinearLayout> 
<LinearLayout android:id="@+id/controlPanel" 
    android:layout_alignParentBottom="true" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
    <Button android:id="@+id/btnClearList" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/clear_list"/> 
    <Button android:id="@+id/btnConfirmList" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/confirm_btn"/> 
</LinearLayout> 
<ListView android:id="@+id/android:list" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_above="@id/controlPanel" 
    android:layout_below="@id/newEntry" /> 
<TextView android:id="@+id/android:empty" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/no_items" 
    android:layout_below="@id/newEntry" 
    android:textColor="#000000" /> 
</RelativeLayout> 

回答

0

你可以通過使用。將這一行添加到xml中的ListView中。

android:scrollingCache="false" 
+0

謝謝,這是做的伎倆。 – user881649

0

這可能是一個ListView背景繪製的問題。查看this文章以進行討論和修復。

您也可能會看到背景顏色與活動的默認主題(淺或暗)之間有輕微干擾。嘗試將主題更改爲輕型版本(Theme.Light)。