How to do it using selector instead of changing background?
if(isSelected) {
binding.cvStainMaster.setBcackgroundResource(R.drawable.boarder_blue_corner);
binding.btnStart.setBackgroundResource(R.drawable.bg_button_primary);
isSelected = false;
}else{
binding.cvStainMaster.setBackgroundColor(Color.WHITE);
binding.btnStart.setBackgroundResource(R.drawable.button_background_with_corner);
isSelected = true;
}
I have done it by changing background. but I want it to do using selector
CodePudding user response:
Using the androidx.cardview.widget.CardView
there is no any property to change the border/stroke colour but you can achieve it using the com.google.android.material.card.MaterialCardView
from
Result for android:state_checked=true
: