Android button setColorFilter behaviour

后端 未结 5 1400
失恋的感觉
失恋的感觉 2020-12-10 09:26

(I changed the question a bit, because the problem is a bit clearer now)

I have 4 buttons on my application, and when a user clickes certain button I change that but

5条回答
  •  甜味超标
    2020-12-10 10:04

    You just need to mutate each drawable before setColorFilter.

    Drawable d = findViewById(R.id.ans2).getBackground();
    
    d = d.mutate();
    d.setColorFilter
    

提交回复
热议问题