Forked from dmytrodanylyk/res_color_btn_flat_selector.xml
Last active
August 29, 2015 14:22
-
-
Save ugommirikwe/075d5a901eefd6b2dc54 to your computer and use it in GitHub Desktop.
Android Material (Flat) Button style themeing code snippets
This file contains 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_enabled="false" | |
android:color="@color/flat_disabled_text"/> | |
<item android:color="@color/flat_normal_text"/> | |
</selector> |
This file contains 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"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<solid android:color="@android:color/white" /> | |
<corners android:radius="@dimen/btn_flat_corner_radius" /> | |
</shape> |
This file contains 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"?> | |
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
android:color="@color/flat_pressed"> | |
<item | |
android:id="@android:id/mask" | |
android:drawable="@drawable/btn_flat_normal"/> | |
</ripple> |
This file contains 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"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<solid android:color="@color/flat_pressed" /> | |
<corners android:radius="@dimen/btn_flat_corner_radius" /> | |
</shape> |
This file contains 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" | |
android:exitFadeDuration="@android:integer/config_mediumAnimTime" | |
android:enterFadeDuration="@android:integer/config_mediumAnimTime"> | |
<item android:drawable="@drawable/btn_flat_pressed" android:state_pressed="true" /> | |
<item android:drawable="@android:color/transparent" /> | |
</selector> |
This file contains 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
<Button | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
style="@style/AppCompat.Button.Flat" | |
android:text="Button"/> |
This file contains 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="flat_pressed">#66999999</color> | |
<color name="flat_disabled_text">#40000000</color> | |
<color name="flat_normal_text">#000000</color> | |
</resources> |
This file contains 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> | |
<dimen name="btn_flat_corner_radius">1dp</dimen> | |
<dimen name="btn_flat_min_width">88dp</dimen> | |
<dimen name="btn_flat_min_height">36dp</dimen> | |
<dimen name="btn_flat_padding">8dp</dimen> | |
<dimen name="btn_flat_margin">4dp</dimen> | |
</resources> |
This file contains 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
<resources> | |
<style name="AppCompat.Button.Flat.Common" parent="Base.TextAppearance.AppCompat.Button"> | |
<item name="android:background">@drawable/btn_flat_selector</item> | |
<item name="android:minWidth">@dimen/btn_flat_min_width</item> | |
<item name="android:minHeight">@dimen/btn_flat_min_height</item> | |
<item name="android:textColor">@color/btn_flat_selector</item> | |
<item name="android:textAllCaps">true</item> | |
<item name="android:textStyle">bold</item> | |
<item name="android:paddingLeft">@dimen/btn_flat_padding</item> | |
<item name="android:paddingRight">@dimen/btn_flat_padding</item> | |
<item name="android:layout_marginLeft">@dimen/btn_flat_margin</item> | |
<item name="android:layout_marginRight">@dimen/btn_flat_margin</item> | |
</style> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment