我需要将行视图背景颜色更改为蓝色,它是这样的:
xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="@dimen/main_info_cell_view_width"
android:layout_height="@dimen/main_info_cell_view_height"
android:background="@color/main_info_cell_background_color" >
<FrameLayout
android:id="@+id/pic_frame"
android:layout_width="@dimen/channel_pic_background_widht"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" >
<View
android:id="@+id/channel_pic_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/main_info_cell_pic_background_color" />
<ImageView
android:id="@+id/channel_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/c__no_image" />
</FrameLayout>
<View
android:id="@+id/divider"
android:layout_width="@dimen/main_info_cell_divider_widht"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/pic_frame"
android:background="@color/main_info_cell_divider_color" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/title_margin_left"
android:layout_marginRight="@dimen/title_margin_right"
android:layout_marginTop="@dimen/title_margin_top"
android:layout_toRightOf="@+id/divider"
android:ellipsize="end"
android:lines="2"
android:textColor="@color/main_info_cell_title_color"
android:textSize="@dimen/title_text_size" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/time_margin_bottom"
android:layout_marginLeft="@dimen/time_margin_left"
android:layout_toRightOf="@+id/divider"
android:textColor="@color/main_info_cell_time_color"
android:textSize="@dimen/time_text_size" />
<TextView
android:id="@+id/pos_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/pos_nr_margin_right"
android:textColor="@color/main_info_cell_pos_nr_color"
android:textSize="@dimen/pos_nr_size" />
</RelativeLayout>
我尝试对行使用选择器,但问题是选择器仅更改视图的背景颜色,而 ImageView 下方的黑色方块仍保持黑色,我如何更改其颜色以及行背景?