Created
March 12, 2018 08:38
-
-
Save Tsutou/a42a9f5cbf86fca73c07562ad2084528 to your computer and use it in GitHub Desktop.
[ Android ] 丸く広がるRippleを、サクッと実装 ref: https://qiita.com/Tsutou/items/515308bfe715dd5ce05e
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
<FrameLayout | |
style="@style/RippleFrameStyle" | |
android:padding="20dp"> | |
<Button | |
style="@style/ButtonStyle" | |
android:background="@drawable/icon" /> | |
</FrameLayout> |
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
<!--リップルエフェクトを出すための親レイアウト--> | |
<style name="RippleFrameStyle"> | |
<item name="android:layout_width">wrap_content</item> | |
<item name="android:layout_height">wrap_content</item> | |
<item name="android:layout_centerVertical">true</item> | |
<item name="android:background">?attr/selectableItemBackgroundBorderless</item> | |
<item name="android:clickable">true</item> | |
<item name="android:focusable">true</item> | |
</style> | |
<!--配置する見た目となるレイアウト--> | |
<style name="ButtonStyle"> | |
<item name="android:layout_width">30dp</item> | |
<item name="android:layout_height">30dp</item> | |
<item name="android:layout_centerVertical">true</item> | |
<item name="android:clickable">false</item> | |
</style> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment