Last active
November 15, 2017 20:51
-
-
Save believe2200/6edc984370d1fc2feed0 to your computer and use it in GitHub Desktop.
リップルで水面のようなボタンオンオフ
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
<ImageButton | |
android:id="@+id/imageView01" | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:layout_margin="3dp" | |
android:layout_weight="1" | |
android:background="@drawable/btn_main01" | |
android:elevation="3dp" /> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
android:color="#FFFFFFFF"> | |
<item android:drawable="@drawable/image01"/> | |
</ripple> | |
RippleとSelectorを併用する | |
selectorと組み合わせるときは以下の様に行います。。 | |
Ripple Effectによりpress状態などは適用しなくて済むのですが、disableなどは指定してあげる必要があります。 | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:state_enabled="false" android:drawable="@drawable/disable" /> <!-- 使用不可の時の画像--> | |
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#fffff" ><!-- 波紋の色 --> | |
<item android:id="@android:id/mask" android:drawable="@drawable/mask" /><!-- 波紋を広げる範囲 --> | |
<item android:drawable="@drawable/back" /><!-- ボタンの背景--> | |
</ripple> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment