选择器颜色不显示自定义列表视图(图)



我已经为我的ListView添加了自定义样式,但是现在发生了一些奇怪的事情。

1)当我单击列表上的一个项目时,选择器(alt颜色)没有出现。代替。标准的绿色选择器出现了,但它是BEHIND列表中每一行的圆边。就好像是默认的ListView与标准的黑色行是流血背后我的风格enter code here一个。对如何解决这个问题有什么想法吗?有没有人遇到过类似的问题,而与自定义列表视图工作?

2)当我快速浏览列表时,背景颜色变回标准的黑色,不再是我设计的蓝色。

所以基本上这两个是我现在面临的问题,选择器不显示和黑色背景"出血"在我的灰色行后面,当我通过列表。任何关于这个问题的帮助/指导将是非常感激的,谢谢!我已经附上了一张图片

这是我的listview_row.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dip" 
android:background="@drawable/listview_background"

>

<ImageView
    android:id="@+id/imgViewLogo"
    android:layout_width="50dip"
    android:layout_height="50dip"
    android:layout_alignParentLeft="true"
    android:scaleType="fitXY"
    android:src="@drawable/imgview_drawable" >
</ImageView>
<TextView
    android:id="@+id/txtViewTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="2dip"
    android:layout_toRightOf="@+id/imgViewLogo"
    android:text="TextView"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#43c6db"
    android:textStyle="bold" >
</TextView>
<TextView
    android:id="@+id/txtViewDescription"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/txtViewTitle"
    android:layout_marginLeft="2dip"
    android:layout_toRightOf="@+id/imgViewLogo"
    android:textStyle="bold"
    android:textColor="#000000"
    android:text="TextView" >
 </TextView>





</RelativeLayout>

这是我的主要ListView布局

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" 
android:background="#708090"
>

<ListView
    android:id="@+id/lvAlbumList"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:choiceMode="multipleChoice"
    android:clickable="false"
    android:divider="@drawable/list_divider"
    android:dividerHeight="2dp"
    android:padding="2dp"
    android:listSelector="@drawable/selector"
    android:cacheColorHint="#00000000"
     >


</ListView>
</LinearLayout>

最后这里是我的selector。xml,它是一个可绘制的状态列表

 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
      android:drawable="@drawable/list_item_pressed"/>
<item android:state_focused="true"
      android:drawable="@drawable/list_item_selected" />
<item android:drawable="@drawable/list_item_normal" />
</selector>

[1]: https://p.twimg.com/AiLoEMVCAAIz_6E.png "

尝试将列表选择器设置为"null"或删除列表选择器

而不是在你的自定义列表行视图中设置列表选择器。

最新更新