I am displaying thumbnial in GridView
using YouTubeThumbnailView
. It is working fine. When i click item in GridView
it is clickable.
below is my GridView item Xml
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/_150sdp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="2"
android:paddingBottom="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="@+id/similar_thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/_90sdp"
android:background="@android:color/white"
android:scaleType="centerCrop"
android:src="@drawable/thumbnail_image" />
<TextView
android:layout_below="@+id/similar_thumbnail"
android:id="@+id/similar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:singleLine="true"
android:text="Video Title" />
</LinearLayout>
</android.support.v7.widget.CardView>
Now there is a need to add a play icon button on YouTubeThumbnialView.
When I added a ImageButton
on YouTubeThumbnailView
using RelaytiveLayout
or FrameLayout
, setOnItemClickListner
is not working of GridView
.
Below is xml of add button on YoutubeThumbnailView
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/_150sdp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="2"
android:paddingBottom="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="@+id/similar_thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/_90sdp"
android:background="@android:color/white"
android:scaleType="centerCrop"
android:src="@drawable/thumbnail_image" />
<ImageButton
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="@dimen/_10sdp"
android:background="#00000000"
android:layout_gravity="bottom"
android:scaleType="fitStart"/>
</FrameLayout>
<TextView
android:layout_below="@+id/similar_thumbnail"
android:id="@+id/similar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:singleLine="true"
android:text="Video Title" />
</LinearLayout>
</android.support.v7.widget.CardView>
Why? How can i add button on YouTubeThumbnailView
and make GridView
Clickable