-
-
Save ahmadronaghdev/e31c935d9c999218087ce1b89cacf3ea to your computer and use it in GitHub Desktop.
[Android] Glossy gradient button
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
| <Button | |
| android:id="@+id/button1" | |
| style="@style/GlossyGradientButtonStyle" | |
| android:layout_width="wrap_content" | |
| android:layout_height="@dimen/button_height" | |
| android:minWidth="100dp" | |
| android:text="OK" /> | |
| <Button | |
| android:id="@+id/button2" | |
| style="@style/GlossyGradientButtonStyle" | |
| android:layout_width="wrap_content" | |
| android:layout_height="@dimen/button_height" | |
| android:minWidth="100dp" | |
| android:text="やれやれだぜ" /> |
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
| <resources> | |
| <!-- Button --> | |
| <dimen name="button_height">48dp</dimen> <!-- ボタンの高さ --> | |
| <dimen name="button_radius">15dp</dimen> <!-- くぼみの丸み --> | |
| <dimen name="button_inner_radius">11dp</dimen> <!-- ボタンの丸み --> | |
| <dimen name="button_inner_margin">4dp</dimen> <!-- ボタンのマージン(くぼみの太さ) --> | |
| <dimen name="button_glossy_marginTop">24dp</dimen> <!-- ボタンの光沢グラデーション位置(ボタンの高さの中央値) --> | |
| <dimen name="button_content_paddingLeft">8dp</dimen> <!-- ボタン内の文字の左部パディング --> | |
| <dimen name="button_content_paddingRight">8dp</dimen> <!-- ボタン内の文字の右部パディング --> | |
| <dimen name="button_content_paddingTop">4dp</dimen> <!-- ボタン内の文字の上部パディング --> | |
| <dimen name="button_content_paddingBottom">4dp</dimen> <!-- ボタン内の文字の下部パディング --> | |
| </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
| <resources xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <!-- Glossy Gradient Button Style --> | |
| <style name="GlossyGradientButtonStyle" parent="@android:style/Widget.Button"> | |
| <item name="android:background">@color/button_selector</item> | |
| <item name="android:shadowColor">#979797</item> | |
| <item name="android:shadowRadius">3.0</item> | |
| <item name="android:shadowDx">-0.5</item> | |
| <item name="android:shadowDy">-0.5</item> | |
| <item name="android:paddingLeft">@dimen/button_content_paddingLeft</item> | |
| <item name="android:paddingRight">@dimen/button_content_paddingRight</item> | |
| <item name="android:paddingTop">@dimen/button_content_paddingTop</item> | |
| <item name="android:paddingBottom">@dimen/button_content_paddingBottom</item> | |
| </style> | |
| </resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment