Skip to content

Instantly share code, notes, and snippets.

@Tsutou
Created March 12, 2018 08:38
Show Gist options
  • Save Tsutou/a42a9f5cbf86fca73c07562ad2084528 to your computer and use it in GitHub Desktop.
Save Tsutou/a42a9f5cbf86fca73c07562ad2084528 to your computer and use it in GitHub Desktop.
[ Android ] 丸く広がるRippleを、サクッと実装 ref: https://qiita.com/Tsutou/items/515308bfe715dd5ce05e
<FrameLayout
style="@style/RippleFrameStyle"
android:padding="20dp">
<Button
style="@style/ButtonStyle"
android:background="@drawable/icon" />
</FrameLayout>
<!--リップルエフェクトを出すための親レイアウト-->
<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