Android Question SetCheckboxColors problem

trueboss323

Active Member
Licensed User
Longtime User
Here is how I am changing the checkbox:

B4X:
Sub Globals
Dim chk as ACCheckbox
End Sub

chk.SetCheckBoxColors(Colors.Transparent,Colors.Transparent,Colors.Blue)

Since this checkbox will always be disabled i am only concerned about changing the DisabledColor .

In the screenshot it is supposed to be changing to blue color. When i test this on Android 4 & 6 , the colors are bright blue just like how I want them. But when i test it on Android 5 , it's more faded and you can hardly even see it. I have no idea why it works on the older and newer versions but not on Lollipop. Have i encountered a bug ?

Untitled.png
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Try to change the colors in the manifest:
B4X:
CreateResource(values, theme.xml,
<resources>
  <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  <item name="colorPrimary">#FFFE0000</item>
  <item name="colorPrimaryDark">#FFFA00D9</item>
  <item name="android:textColorSecondary">#FFFA00D9</item>
  <item name="colorAccent">#FF0025FC</item>
  <item name="windowNoTitle">true</item>
  <item name="windowActionBar">false</item>
  </style>
</resources>
)

The relevant attributes are colorAccent (checked color) and android:textColorSecondary (unchecked color).
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
Setting colors with setxxxTintList functions in Android is not very consistent with different Android versions.

The next version of the AppCompat library (whenever it will be released) will have a style-Feature. With that you will be able to set colors of every single AppCompat View (like Buttons, Checkboxes etc.) with an xml style.
 
Upvote 0
Top