Skip to content

Instantly share code, notes, and snippets.

@sanjeevbishnoi
Last active October 26, 2018 13:05
Show Gist options
  • Save sanjeevbishnoi/8ff3315713f87b13df1f825144bcfa6f to your computer and use it in GitHub Desktop.
Save sanjeevbishnoi/8ff3315713f87b13df1f825144bcfa6f to your computer and use it in GitHub Desktop.
Youtube Thumbnail UI
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:orientation="vertical"
app:cardBackgroundColor="@color/white"
app:cardElevation="0.4dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false"
app:cardCornerRadius="2dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:id="@+id/cardview"
tools:targetApi="lollipop">
<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="wrap_content"
android:orientation="vertical">
<FraameLayout
android:id="@+id/video_view"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@color/white_color"
>
<ImageView
android:id="@+id/youtube_thumbnail"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:visibility="visible"/>
<RelativeLayout android:id="@+id/relativeLayout_over_youtube_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:visibility="visible">
<ImageView android:id="@+id/btnYoutube_player"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/youtube"
android:layout_centerInParent="true"
/>
</RelativeLayout>
</FraameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="15dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/video_view"
>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textAppearance="@style/TextAppearanceCollectionTitle"
tools:text="Title"
android:maxLines="2"
android:ellipsize="end"
/>
<TextView
android:id="@+id/text_view_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:textAppearance="@style/TextAppearanceCollectionDesc"
tools:text="Description" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment