|
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_centerInParent="true"
app:cardCornerRadius="22dp"
app:cardUseCompatPadding="true"
app:cardElevation="4dp"
android:foreground="@drawable/purple_bg"
android:clickable="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/silver_bg">
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cardView"
android:gravity="center"
android:text="Changing Card Color on Click"
android:textStyle="bold|italic"
android:textColor="#2F8C46"
android:textSize="20sp" />
</RelativeLayout>
|