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条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器