0

I have written code for ripple effect for a view. This is my code:

styles.xml

    <style name="SelectableItemTheme">
        <item name="colorControlHighlight">#1e333d</item>
    </style>

    <style name="SelectableItemBackground">
        <item name="android:theme">@style/SelectableItemTheme</item>
        <item name="android:background">?attr/selectableItemBackground</item>
    </style>

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <RelativeLayout
        style="@style/SelectableItemBackground"
        android:clickable="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="true">

    </RelativeLayout>

</android.support.design.widget.CoordinatorLayout>

My agenda here is to change the color(random) everytime the user touches the view.

raghhav
  • 167
  • 2
  • 13

0 Answers0