android listview滑动 背景,滚动时背景ListView变为黑色

我创建了一个特定的列表,该列表存在于以下元素之外,以创建一个可滚动的列表,每行的左侧包含一个图像,右侧包含一些文本:

首先使用“根”布局:

xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#C8C8C8"

>

android:layout_width="fill_parent"

android:layout_height="wrap_content"/>

android:id="@android:id/list"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:drawSelectorOnTop="false"

android:divider="#C8C8C8"

android:background="#C8C8C8"/>

然后在ListView中放置以下“行”项:

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:orientation="horizontal"

android:background="@drawable/bg_row"

>

android:layout_width="wrap_content"

android:paddingLeft="10px"

android:paddingRight="15px"

android:paddingTop="5px"

android:paddingBottom="5px"

android:layout_height="wrap_content"

android:src="@drawable/bg_image"

/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:paddingTop="5px"

android:paddingBottom="5px"

android:textSize="16sp"

android:textColor="#000000"

android:layout_gravity="center"

android:maxHeight="50px"/>

只要屏幕是静态显示的(静止不动),它将正确显示,但是当我开始滚动列表时,将显示行项目的背景(代码中可以显示“图标”)可以正确显示,但“根”布局的背景将变为完全黑色...当滚动停止时,背景通常会恢复其颜色...当我测试时,我还在TextView该根元素中添加了一个在相同的背景下,滚动列表时,该颜色将保留其颜色...知道为什么会发生这种情况以及如何解决此问题吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值