Last active
August 29, 2015 13:57
-
-
Save scruffyfox/9917717 to your computer and use it in GitHub Desktop.
Card drawable
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
Basic card layout with drawables and styles. | |
Missing icons: ic_action_remove, ic_action_accept and ic_action_cancel (all can be found in the standard android icon pack) | |
Example screenshot: https://pbs.twimg.com/media/BmTdvKhIYAAkrPa.png |
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
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:state_pressed="true" android:drawable="@color/card_selection_state_pressed" /> | |
<item android:drawable="@android:color/transparent" /> | |
</selector> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<!--<item>--> | |
<!--<shape>--> | |
<!--<padding android:top="10dp" android:right="10dp" android:bottom="5dp" android:left="10dp" />--> | |
<!--<solid android:color="@color/transparent" />--> | |
<!--</shape>--> | |
<!--</item>--> | |
<item> | |
<shape> | |
<padding android:top="0dp" android:right="0dp" android:bottom="1dp" android:left="0dp" /> | |
<solid android:color="@color/card_shadow_1" /> | |
<corners android:radius="2dp" /> | |
</shape> | |
</item> | |
<item> | |
<shape> | |
<padding android:top="0dp" android:right="0dp" android:bottom="1dp" android:left="0dp" /> | |
<solid android:color="@color/card_shadow_2" /> | |
<corners android:radius="2dp" /> | |
</shape> | |
</item> | |
<!-- Background --> | |
<item> | |
<shape > | |
<solid android:color="@color/card_background" /> | |
<corners android:radius="2dp" /> | |
</shape> | |
</item> | |
</layer-list> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:padding="8dp" | |
> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical" | |
android:background="@drawable/card_bg" | |
> | |
<RelativeLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
> | |
<ImageView | |
android:layout_width="42dp" | |
android:layout_height="wrap_content" | |
android:id="@+id/card_close" | |
android:layout_alignParentRight="true" | |
android:layout_alignParentTop="true" | |
android:src="@drawable/ic_action_remove" | |
android:padding="8dp" | |
android:clickable="true" | |
/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:id="@+id/card_title" | |
android:layout_toLeftOf="@id/card_close" | |
style="@style/Card.TitleText" | |
/> | |
</RelativeLayout> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:id="@+id/card_description" | |
style="@style/Card.DescriptionText" | |
/> | |
<View | |
android:layout_marginLeft="8dp" | |
android:layout_marginRight="8dp" | |
style="@style/divider" | |
/> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="horizontal" | |
> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:id="@+id/card_action" | |
android:drawableLeft="@drawable/ic_action_accept" | |
android:layout_weight="1" | |
style="@style/Card.AcceptText" | |
/> | |
<View | |
android:layout_width="1dp" | |
android:layout_height="match_parent" | |
android:layout_marginTop="8dp" | |
android:layout_marginBottom="8dp" | |
android:background="#E5E5E5" | |
/> | |
<TextView | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:id="@+id/card_action_close" | |
android:drawableLeft="@drawable/ic_action_cancel" | |
android:text="No thank you" | |
android:layout_weight="1" | |
style="@style/Card.DeclineText" | |
/> | |
</LinearLayout> | |
</LinearLayout> | |
</FrameLayout> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="transparent">#00000000</color> | |
<!-- card colors --> | |
<color name="card_background">#ffffff</color> | |
<color name="card_shadow_1">#d4d4d4</color> | |
<color name="card_shadow_2">#dddddd</color> | |
<color name="card_detailing">#eee</color> | |
<color name="card_selection_state_pressed">#20cccccc</color> | |
</resources> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources xmlns:android="http://schemas.android.com/apk/res/android"> | |
<style name="Card.TitleText" parent="android:TextAppearance.Large"> | |
<item name="android:textSize">24sp</item> | |
<item name="android:fontFamily">sans-serif-light</item> | |
<item name="android:textColor">#555</item> | |
<item name="android:padding">8dp</item> | |
</style> | |
<style name="Card.AcceptText" parent="android:TextAppearance"> | |
<item name="android:textSize">15sp</item> | |
<item name="android:textColor">#63D64A</item> | |
<item name="android:gravity">center_vertical</item> | |
<item name="android:padding">15dp</item> | |
<item name="android:drawablePadding">8dp</item> | |
<item name="android:clickable">true</item> | |
<item name="android:background">@drawable/card_action_drawable</item> | |
</style> | |
<style name="Card.DeclineText" parent="Card.AcceptText"> | |
<item name="android:textColor">#D40004</item> | |
</style> | |
<style name="Card.DescriptionText" parent="android:TextAppearance"> | |
<item name="android:padding">8dp</item> | |
<item name="android:textColor">#ff000000</item> | |
</style> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment