I created a ListView in an Activity with a white background. However, if I sweep through the items, their background become black and cover the text. How can I disable it? The listview uses ArrayAdapter to populate it.
Here's my 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>
You can do that by using. Add this line in your ListView in the xml.
android:scrollingCache="false"