Skip to content

Instantly share code, notes, and snippets.

@beall49
Created January 14, 2016 21:19
Show Gist options
  • Select an option

  • Save beall49/4346c552a1e8d6b3efc1 to your computer and use it in GitHub Desktop.

Select an option

Save beall49/4346c552a1e8d6b3efc1 to your computer and use it in GitHub Desktop.
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="300dp"
app:cardUseCompatPadding="true"
app:cardElevation="@dimen/elevation">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/imgCardView"
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_alignParentTop="true"
android:scaleType="centerCrop"
android:src="@drawable/logored" />
<TextView
android:id="@+id/txtTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imgCardView"
android:layout_alignStart="@+id/imgCardView"
android:layout_margin="1dp"
android:background="@drawable/background_inner"
android:paddingEnd="1dp"
android:paddingStart="@dimen/material_margin_xsmall"
android:text="@string/title_activity_card_view"
android:textColor="@color/icons"
android:textSize="@dimen/large_text" />
<TextView
android:id="@+id/txtTitle2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/txtTitle"
android:layout_alignEnd="@+id/txtTitle"
android:layout_margin="1dp"
android:gravity="end"
android:paddingEnd="@dimen/material_margin_xsmall"
android:paddingStart="@dimen/material_margin_xsmall"
android:text="@string/learn_more"
android:textColor="@color/icons"
android:textSize="@dimen/small_text" />
<TextView
android:id="@+id/txtText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imgCardView"
android:maxLines="3"
android:paddingBottom="1dp"
android:paddingEnd="2dp"
android:paddingStart="2dp"
android:paddingTop="1dp"
android:text="@string/cardview_contents"
android:textColor="@color/secondary_text"
android:textSize="@dimen/normal_text" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment