ArminKH
Well-Known Member
hi
why this code works
but this one not works(for disabled state)
what is the problem? this code works for Checked and Enabled state but dont works for disabled state
same code works for ACCheckBox
@corwin42
why this code works
B4X:
Public Sub SetRadioButtonStatesColor(AppCompatRadioButton As ACRadioButton,CheckedColor As Int,EnabledColor As Int,DisabledColor As Int)
Dim States(3,1) As Int
States(0,0) = 16842912 'Checked
States(1,0) = 16842910 'Enabled
States(2,0) = -16842910 'Disabled
Dim Color(3) As Int = Array As Int(CheckedColor,EnabledColor,DisabledColor)
Dim CSL As JavaObject
CSL.InitializeNewInstance("android.content.res.ColorStateList",Array As Object(States,Color))
Dim CB1 As JavaObject = AppCompatRadioButton
CB1.RunMethod("setSupportButtonTintList",Array As Object(CSL))
End Sub
B4X:
public void SetRadioButtonStatesColor(AppCompatRadioButton AppCompatRadioButton,int CheckedColor,int EnabledColor,int DisabledColor){
int[][] States = new int[3][1];
States[0][0] = 16842912; //Checked
States[1][0] = 16842910; //Enabled
States[2][0] = -16842910; //Disabled
int[] Color = new int[3];
Color[0] = CheckedColor;
Color[1] = EnabledColor;
Color[2] = DisabledColor;
ColorStateList colorStateList = new ColorStateList(States,Color);
AppCompatRadioButton.setSupportButtonTintList(colorStateList);
}
same code works for ACCheckBox
@corwin42
Last edited: