Skip to content

Instantly share code, notes, and snippets.

@ShinichiroFunatsu
Created October 3, 2018 01:53
Show Gist options
  • Save ShinichiroFunatsu/2144d5435174996ddc7b44a5ed9b3332 to your computer and use it in GitHub Desktop.
Save ShinichiroFunatsu/2144d5435174996ddc7b44a5ed9b3332 to your computer and use it in GitHub Desktop.
image_text_via_cardview
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/cardView"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:elevation="8dp"
card_view:cardBackgroundColor="@color/colorPrimary"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
>
<!-- image thumbnail -->
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@null"
android:background="@android:color/transparent"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:transitionName="image"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<!-- bookmark counts -->
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
<TextView
android:id="@+id/count"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_margin="12dp"
android:elevation="4dp"
tools:text="9999"
android:layout_gravity="start"
android:gravity="center"
android:background="@drawable/shape_lends"
android:textStyle="bold"
android:textColor="@color/colorBookmarkText"
android:textSize="20sp" />
</FrameLayout>
<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:visibility="invisible"
android:src="@drawable/ic_favorite_24dp"
android:background="@null"
/>
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#88003333"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical"
android:layout_gravity="center_horizontal">
<!-- title text -->
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="#eeffffff"
android:textSize="14sp"
android:layout_marginBottom="8dp"
/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment