Change color of a radio button

前端 未结 11 1879
死守一世寂寞
死守一世寂寞 2020-12-10 02:11

I am developing an quiz based app. There will be 1 question and 4 option(radio buttons). If user select any wrong answer then I want to turn that radio button color to Red.

11条回答
  •  不知归路
    2020-12-10 02:38

    Hope this helps..

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
           radioButton.setButtonTintList(ContextCompat.getColorStateList(mContext, R.color.colorGris));
        }else {//Do something if you have a lower version}
    

    For me its working.

提交回复
热议问题