В этом приложении заметил, что если нажать на элемент и удерживать то элемент окрашивается в сероватый цвет давая понять пользователю что он нажал на него. Как в ListView. Как сделать также? А то я нажимаю/удерживаю на элементе, но непонятно как-то. В ListView тоже окрашивался в сероватый цвет.
Разметка
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp">
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/imgRadio"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/ic_launcher"
app:civ_border_color="@android:color/white"
app:civ_border_width="2dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?android:selectableItemBackground"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<TextView
android:id="@+id/txtRadioTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:singleLine="true"
android:text="Название радио"
android:textColor="@android:color/darker_gray"
android:textSize="16sp" />
<TextView
android:id="@+id/txtRadioCity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:singleLine="true"
android:text="Город"
android:textColor="@android:color/darker_gray"
android:textSize="16sp" />
</LinearLayout>
<ImageButton
android:id="@+id/btnFavorite"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/favorites_button"
android:focusable="false"
android:onClick="onFavoriteClick"
android:padding="15dp"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_star_black" />
</LinearLayout>
</android.support.v7.widget.CardView>