Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 突出显示recyclerView的项目_Android_Android Recyclerview_Recyclerview Layout - Fatal编程技术网

Android 突出显示recyclerView的项目

Android 突出显示recyclerView的项目,android,android-recyclerview,recyclerview-layout,Android,Android Recyclerview,Recyclerview Layout,我想全部突出显示所选列表项,不仅背景颜色,而且整个列表项都应该有相同的颜色 这是一个没有突出显示 我希望输出是这样的 我得到的只是背景色。我用过这个代码 view.setBackgroundResource(R.color.white) 我的输出是这样的 <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="

我想全部突出显示所选列表项,不仅背景颜色,而且整个列表项都应该有相同的颜色

这是一个没有突出显示

我希望输出是这样的

我得到的只是背景色。我用过这个代码

view.setBackgroundResource(R.color.white)

我的输出是这样的

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/alert_Item"
android:layout_marginTop="5dp">


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="8dp"

        android:background="@drawable/list_corners"
        >

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="8dp"
            android:layout_height="13dp"
         />

        <TextView
            android:id="@+id/date"
            android:layout_width="108dp"
            android:layout_height="13dp"
            android:text="member name"
            android:textSize="10sp"
            android:textColor="@color/textColorPrimary"/>

        <TextView
            android:id="@+id/memberName"
            android:layout_width="98dp"
            android:layout_height="13dp"
            android:layout_alignParentRight="true"
            android:text="member name"
            android:textAlignment="textEnd"
            android:textSize="10sp"
            android:textColor="@color/textColorPrimary"/>

        <TextView
            android:id="@+id/alertId"
            android:layout_width="132dp"
            android:layout_height="15dp"
            android:text="alert id"
            android:textSize="12sp"
            android:textColor="@color/textColorPrimary"/>

        <TextView
            android:id="@+id/alertName"
            android:layout_width="72dp"
            android:layout_height="13dp"
            android:layout_alignBaseline="@+id/alertId"
            android:layout_alignParentRight="true"
            android:layout_marginTop="2dp"
            android:text="alert name"
            android:textAlignment="textEnd"
            android:textSize="10sp"
            android:textColor="@color/textColorPrimary"/>


    </RelativeLayout>



粘贴可能的xml代码将回收视图项的xml布局放入xml布局项中…将
android:duplicateParentState=“true”
添加到不显示背景色的布局中,并添加到相同的布局中,您必须设置相同的父级选择器。这将把父母的状态复制到孩子身上。嗨,如果你能添加你的recyclerView实现代码,我会告诉你去哪里change@V-rundPuro hit我已经添加了xml代码粘贴您可能的xml代码将您的xml布局用于recyclerview项在xml布局项中…添加
android:duplicateParentState=“true”
对于不显示背景色的布局和同一布局,必须设置相同的父级选择器。这将把父母的状态复制到孩子身上。嗨,如果你能添加你的recyclerView实现代码,我会告诉你去哪里change@V-rundPuro hit我添加了xml代码