using a custom color for button background while using selectableItemBackground attribute

后端 未结 6 2188
伪装坚强ぢ
伪装坚强ぢ 2021-02-06 21:37

I am trying to use

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

to get my button to do appropriate effects for each android versi

6条回答
  •  心在旅途
    2021-02-06 22:20

    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.

    
    
           
    
    
    

    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

提交回复
热议问题