Android 筆記 - 水波紋效果(Button)

可用在 Button 裡

新增資源檔

新增方法如下
內容為

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#aaaaaa">
<!--ripple中的color為點擊時的顏色-->

<!--基本顏色-->
<item>
<shape>
<solid android:color="#ffffff" />
</shape>
</item>
</ripple>


Button 套用方法

設定在 background 即可

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:textColor="#000000"
android:background="@drawable/bt_selector" />


沒有留言:

張貼留言