XML : Unable to make a CarView child clickable

Here's the layout of the cardview in context:

  <android.support.v7.widget.CardView          android:id="@+id/card"          android:layout_width="match_parent"          android:layout_height="wrap_content"          android:layout_marginLeft="1dp"          android:layout_marginRight="1dp"          android:layout_marginTop="-25dp"          android:clickable="true"          app:cardUseCompatPadding="true"          android:foreground="?android:attr/selectableItemBackground"          app:cardBackgroundColor="@color/md_white_1000"          card_view:cardCornerRadius="4dp"          card_view:cardElevation="10dp">            <RelativeLayout              android:layout_width="match_parent"              android:layout_height="match_parent">                <TextView                  android:id="@+id/title"                  android:layout_width="wrap_content"                  android:layout_height="wrap_content"                  android:layout_marginLeft="10dp"                  android:layout_centerVertical="true"                  android:layout_marginTop="10dp"                  android:layout_marginBottom="10dp"                  android:layout_alignParentLeft="true"                  android:layout_toLeftOf="@+id/icon"                  android:ellipsize="marquee"                  android:marqueeRepeatLimit="marquee_forever"                  android:maxLines="4"                  android:textColor="@color/md_teal_900"                  android:textSize="15sp"                  android:textStyle="bold" />                <ImageView                  android:layout_width="wrap_content"                  android:layout_marginTop="10dp"                  android:layout_marginBottom="10dp"                  android:layout_height="wrap_content"                  android:focusable="true"                  android:layout_alignParentRight="true"                  android:layout_centerVertical="true"                  android:layout_marginRight="5dp"                  android:clickable="true"                  android:id="@+id/icon"                  android:src="@mipmap/ic_download" />              </RelativeLayout>      </android.support.v7.widget.CardView>    

I want only the icon (imageview) to be clickable. This cardview is part of a recyclerview, and I can only make the whole card responsive to click, whereas I want only the imageview to be clickable.

No comments:

Post a Comment