kyleai
kyleai

Reputation: 103

Android Ripple Effect on Background item onclick

I would like to make it so when I click an imageview, it makes the background ripple and change colors. Is this at all possible? My code looks like this.

Thanks.

    <FrameLayout android:id="@+id/container" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?android:attr/selectableItemBackground"
    android:exitFadeDuration="@android:integer/config_shortAnimTime">
    <item android:id="@android:id/mask">
        <shape android:shape="rectangle" >
            <solid android:color="@android:color/holo_green_light" />
        </shape>
    </item>



    <ImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:maxHeight="100dp"
        android:maxWidth="100dp"
        android:id="@+id/imageView"
        android:layout_gravity="center"
        android:scaleType="centerCrop"
        />

Upvotes: 0

Views: 2306

Answers (1)

Chandrakanth
Chandrakanth

Reputation: 3831

To see the ripple effect for the image view

android:background="?android:attr/selectableItemBackground"

Upvotes: 3

Related Questions