myc_100 2013-02-04 02:48 采纳率: 10%
浏览 2924
已采纳

在 listview 中滑动 items 时背景出现的问题

我在 activity 中使用白色背景创建了一个 ListView。但是,当我滑动这些 items 时,背景就变成黑色并且把文本也覆盖了。
如何修改它呢? listview 是使用 ArrayAdapter 来填充的。
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>
  • 写回答

2条回答

  • 80后VS烦恼 2013-02-04 04:38
    关注

    应该加上这个:android:cacheColorHint="#00000000"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?