android.graphics.drawable.RippleDrawable is a drawable that shows a ripple effect in response to state changes. Here is a simple example to show user touch with RippleDrawable.
Create file drawable/rippple.xml.
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#00ffff" />
layout/activity_main.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:clickable="true"
android:background="@drawable/rippple" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/ic_launcher"
android:clickable="true"
android:background="@drawable/rippple" />
</LinearLayout>
Next:
- RippleDrawable with mask
- RippleDrawable with drawable
No comments:
Post a Comment