我在一个LinearLayout中有两个LinearLayout。LinearLayout的背景是可绘制的。一切都很好,但是当我使用任何一个ListView时,背景图像就会消失,黑色的背景就会显示出来。当fling停止时,图像将再次显示为背景。我不想改变背景,我做错什么了吗?
布局如下:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:text="Upcoming Trips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/top_blue_box"
android:textColor="#ffffff"
android:textStyle="bold"
android:textSize="16sp"
android:layout_gravity="center"
/>
<ListView
android:id="@+id/upList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
/>
<TextView
android:text="Past Trips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bottom_box"
android:textColor="#ffffff"
android:textStyle="bold"
android:textSize="16sp"
android:layout_gravity="center_horizontal"
/>
<ListView
android:id="@+id/downList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
/>
</LinearLayout>编辑:解决方案是详细解释这里的,这要感谢罗宾汉。
发布于 2012-03-13 06:21:14
使用
listView.setCacheColorHint(Color.TRANSPARENT);在爪哇或
android:cacheColorHint="#00000000"在xml中的ListView标记
发布于 2012-03-13 06:21:46
向列表视图应用与布局颜色相同的颜色缓存提示。
示例:
android:cacheColorHint="light blue"缓存颜色提示
https://stackoverflow.com/questions/9679222
复制相似问题