While working with @DonManfred 's wrap of the VectorCompat library I needed to set a ColorStateList to
a VectorDrawable ForegroundTintList property.
After fiddling around with xml files in the drawable folder I needed a more flexible way to set the foreground colors and found a snippet from @stevel05 here and modified it a little bit to use it as object.
a VectorDrawable ForegroundTintList property.
After fiddling around with xml files in the drawable folder I needed a more flexible way to set the foreground colors and found a snippet from @stevel05 here and modified it a little bit to use it as object.
...as it is also needed here:
- https://www.b4x.com/android/forum/threads/tabhostextras.11056/#content
- https://www.b4x.com/android/forum/threads/scratchview-v1-2.66876/#content
- https://www.b4x.com/android/forum/threads/creditsrollview-v1-0-0.54087/#content
- https://www.b4x.com/android/forum/threads/afollestad-materialdialogs-reborn.67849/
- https://www.b4x.com/android/forum/threads/bcmaterial-a-community-material-wrapper-open-source.54954/
- https://www.b4x.com/android/forum/threads/switchbutton.65334/#content
B4X:
Sub GetColorStatelist(intColorPressed As Int, intColorEnabled As Int, intColorDisabled As Int) As JavaObject
Dim States(3,1) As Int
States(0,0) = 16842919 'Pressed
States(1,0) = 16842910 'Enabled
States(2,0) = -16842910 'Disabled
Dim Color(3) As Int = Array As Int(intColorPressed, intColorEnabled, intColorDisabled)
Dim csl As JavaObject
csl.InitializeNewInstance("android.content.res.ColorStateList",Array As Object(States,Color))
'
Return csl
'
End Sub