using a custom color for button background while using selectableItemBackground attribute

If you read the source code of Button.java then you will see that it is a subclass of TextView.java. I have made a simple workaround for the problem in question.

<LinearLayout android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:clickable="true"
              android:background="#1f5050">

       <TextView android:layout_width="some_dp"
                 android:layout_height="some_dp"
                 android:id="@+id/button"
                 android:background="?android:selectableItemBackground" />

</LinearLayout>

In code:

button.setOnClickLisetener(new Onclicklistener() {
    // do your stuff here
}

It would be much better if someone can extend the TextView class and make a custom Button with the feature in question.

Note: my minsdk is 14. also, the lollipop ripple effect works just fine

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)