Created
December 18, 2017 15:02
-
-
Save n1lesh/9611fae84a1bc524f955a9e9b0f28ef8 to your computer and use it in GitHub Desktop.
Android CardView Sample - XML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.v7.widget.CardView | |
android:layout_width="match_parent" | |
android:layout_height="250dp" | |
app:cardBackgroundColor="@android:color/white" | |
app:cardCornerRadius="0dp" | |
app:cardMaxElevation="1dp" | |
app:cardElevation="0.7dp" | |
app:contentPadding="10dp" | |
app:contentPaddingBottom="0dp" | |
app:cardPreventCornerOverlap="true" | |
app:cardUseCompatPadding="true" | |
android:id="@+id/cardView"> | |
<RelativeLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ImageView | |
android:layout_width="match_parent" | |
android:layout_height="180dp" | |
android:scaleType="centerCrop" | |
android:id="@+id/img" | |
android:src="@drawable/joshua_sortino" | |
android:contentDescription="CardImageViewDesc" /> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_below="@id/img" | |
android:layout_marginLeft="5dp" | |
android:layout_marginStart="5dp" | |
android:fontFamily="sans-serif" | |
android:gravity="center_vertical" | |
android:text="Joshua Sortino - Via Unsplash" | |
android:textSize="18sp" /> | |
<ImageButton | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:layout_alignParentEnd="true" | |
android:layout_alignParentRight="true" | |
android:background="?attr/selectableItemBackgroundBorderless" | |
android:src="@drawable/ic_favorite_border" | |
android:layout_below="@id/img" | |
android:layout_marginRight="5dp" | |
android:layout_marginEnd="5dp" | |
android:contentDescription="FavButtonDesc" /> | |
</RelativeLayout> | |
</android.support.v7.widget.CardView> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment