This is a simple cross platform Checkbox.
If you need a checkbox with text, then check out the
AS_CheckBoxAdvanced
I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it
here by Paypal or with a
coffee .
Spoiler: Dependencies/Libraries you need for this view
B4j : jXUI,JavaObject
B4a : XUi,StringUtils,XUI Views (2.40+)
B4i : iXUI,XUI Views (2.40+)
View attachment 99463 View attachment 99464 View attachment 99465
View attachment 99494 View attachment 99496
Disabled style:
View attachment 103672
AS_Checkbox
Author: Alexander Stolte
Version: 2.00
Spoiler: Properties, Functions, Events, etc.
ASCheckbox
Events:
CheckedChange (Checked As Boolean )
Fields:
mBase As B4XView
Tag As Object
Functions:
Base_Resize (Width As Double , Height As Double )
DesignerCreateView (Base As Object , Lbl As Label , Props As Map )
Base type must be Object
Initialize (Callback As Object , EventName As String )
SetIcon (icon As String , isfontawesome As Boolean )
Properties:
BorderCornerRadius As Int [write only]
BorderWidth As Int [write only]
Checked As Boolean
Checked2 As Boolean [write only]
Without the CheckedChange Event
CheckedAnimated As Boolean [write only]
CheckedBackgroundColor As Int [write only]
DisabledBackgroundColor As Int
DisabledIconColor As Int
Enabled As Boolean
IconColor As Int
isEvent As Boolean
isFillUncheckedBackgroundColor As Boolean
isFontAswesome As Boolean
isHaptic As Boolean
isround As Boolean
Theme As AS_CheckBox_Theme [write only]
Theme_Dark As AS_CheckBox_Theme [read only]
Theme_Light As AS_CheckBox_Theme [read only]
UncheckedBackgroundColor As Int
UncheckedIconColor As Int
Changelog
Spoiler: Version 1.0-1.12
1.00
1.01
Add CheckedAnimated
B4J BugFix Label Size was resizing if the font was to big
1.02
1.03
1.04
Add DisabledBackgroundColor property and designer property
Add DisabledIconColor property and designer property
Add Enable property - enable or disable the view
no animation if you change the checked state via code
1.05
B4I No Jump animation if the BorderCornerRadius > 0 (the radius cannot be held during animation, so it looks buggy when you have e.g. a circle)
BugFix - Enabled = False, now the view is disabled, no touch gestures allowed
1.06
Intern Function IIF renamed to iif2
1.07
Add DesingerProperty Checked - if true then the checkbox is checked
Add DesingerProperty Enabled - if false then the checkbox is disabled
On B4A and B4J the core enabled property in the designer is not used anymore
BugFixes
Intern Function iif2 removed and the core iif is now used
B4A V11+ - B4J V9.10+ - B4I V7.50+
1.08
BugFix - When creating the view the CheckedChange event was triggered with parameter "False"
1.09
Add Event property - If False then the CheckedChange event is not triggered
1.10
Base_Resize is now public
1.11
Intern Improvements
Add get and set IconColor
1.12
Add set Checked2 - Without the CheckedChange Event
2.00 ( read more )
Add Designer Property FillUncheckedBackgroundColor
Add Designer Property UncheckedBackgroundColor
Add Designer Property UncheckedIconColor
Add Designer Property Round
Add set Theme
Add get Theme_Dark
Add get Theme_Light
Add Designer Property ThemeChangeTransition
Have Fun