Apr 2, 2016 Replies: 36 This is a wrap for this Github-project. You need B4A V5.8+ to use this library. You need B4A 6+ to use V1.5+ of this library. New in V1.5 - The library is now available as aar file. - I´ve added TextColor property SwitchButton Author: DonManfred (wrapper) Version: 2.1 SwitchButton Events: onCheckedChanged (checked As Boolean) Fields: ba As BA Methods: BringToFront DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map) Initialize (EventName As String) Invalidate Invalidate2 (arg0 As Rect) Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) IsInitialized As Boolean RemoveView RequestFocus As Boolean SendToBack SetBackgroundImage (arg0 As Bitmap) SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int) SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int) SetVisibleAnimated (arg0 As Int, arg1 As Boolean) isDrawDebugRect As Boolean isFadeBack As Boolean performClick As Boolean setText (onText As CharSequence, offText As CharSequence) setThumbMargin (left As Float, top As Float, right As Float, bottom As Float) setThumbSize (width As Float, height As Float) toggleImmediately Properties: AnimationDuration As Long BackColor As ColorStateList BackDrawable As Drawable BackDrawableRes As String [write only] BackMeasureRatio As Float BackRadius As Float BackSizeF As PointF [read only] Background As Drawable Checked As Boolean [write only] CheckedImmediately As Boolean [write only] Color As Int [write only] DrawDebugRect As Boolean [write only] Enabled As Boolean FadeBack As Boolean [write only] Height As Int Left As Int Parent As Object [read only] Process As Float Tag As Object ThumbColor As ColorStateList ThumbDrawable As Drawable ThumbDrawableRes As String [write only] ThumbHeight As Float [read only] ThumbMargin As RectF [read only] ThumbMarginRect As RectF [write only] ThumbRadius As Float ThumbSize2 As PointF [write only] ThumbSizeF As PointF [read only] ThumbWidth As Float [read only] TintColor As Int Top As Int Visible As Boolean Width As Int Code: SwitchButton1.ThumbDrawableRes = "flyme_thumb_drawable" SwitchButton1.BackDrawableRes = "flyme_back_drawable" SwitchButton2.BackDrawableRes = "ios_back_drawable" SwitchButton3.ThumbDrawableRes = "miui_thumb_drawable" SwitchButton3.BackDrawableRes = "miui_back_drawable" SwitchButton4.ThumbDrawableRes = "icon_github" SwitchButton5.ThumbDrawableRes = "ios_back_drawable" Attachments SwitchButtonV1.0.0.zip SwitchButtonV1.0.0.zip 19.4 KB · Views: 862 SwitchButtonV1.0.1.zip SwitchButtonV1.0.1.zip 19.2 KB · Views: 872 SwitchButtonV1.5.zip SwitchButtonV1.5.zip 33 KB · Views: 928 SwitchButtonV2.1.zip SwitchButtonV2.1.zip 32.7 KB · Views: 1,040 SwitchButtonEx.zip SwitchButtonEx.zip 26.4 KB · Views: 1,022 Last edited: Jul 15, 2017 Click to expand...
This is a wrap for this Github-project. You need B4A V5.8+ to use this library. You need B4A 6+ to use V1.5+ of this library. New in V1.5 - The library is now available as aar file. - I´ve added TextColor property SwitchButton Author: DonManfred (wrapper) Version: 2.1 SwitchButton Events: onCheckedChanged (checked As Boolean) Fields: ba As BA Methods: BringToFront DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map) Initialize (EventName As String) Invalidate Invalidate2 (arg0 As Rect) Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) IsInitialized As Boolean RemoveView RequestFocus As Boolean SendToBack SetBackgroundImage (arg0 As Bitmap) SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int) SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int) SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int) SetVisibleAnimated (arg0 As Int, arg1 As Boolean) isDrawDebugRect As Boolean isFadeBack As Boolean performClick As Boolean setText (onText As CharSequence, offText As CharSequence) setThumbMargin (left As Float, top As Float, right As Float, bottom As Float) setThumbSize (width As Float, height As Float) toggleImmediately Properties: AnimationDuration As Long BackColor As ColorStateList BackDrawable As Drawable BackDrawableRes As String [write only] BackMeasureRatio As Float BackRadius As Float BackSizeF As PointF [read only] Background As Drawable Checked As Boolean [write only] CheckedImmediately As Boolean [write only] Color As Int [write only] DrawDebugRect As Boolean [write only] Enabled As Boolean FadeBack As Boolean [write only] Height As Int Left As Int Parent As Object [read only] Process As Float Tag As Object ThumbColor As ColorStateList ThumbDrawable As Drawable ThumbDrawableRes As String [write only] ThumbHeight As Float [read only] ThumbMargin As RectF [read only] ThumbMarginRect As RectF [write only] ThumbRadius As Float ThumbSize2 As PointF [write only] ThumbSizeF As PointF [read only] ThumbWidth As Float [read only] TintColor As Int Top As Int Visible As Boolean Width As Int Code: SwitchButton1.ThumbDrawableRes = "flyme_thumb_drawable" SwitchButton1.BackDrawableRes = "flyme_back_drawable" SwitchButton2.BackDrawableRes = "ios_back_drawable" SwitchButton3.ThumbDrawableRes = "miui_thumb_drawable" SwitchButton3.BackDrawableRes = "miui_back_drawable" SwitchButton4.ThumbDrawableRes = "icon_github" SwitchButton5.ThumbDrawableRes = "ios_back_drawable"
MarcoRome Expert Licensed User Longtime User Nov 23, 2016 #21 DonManfred said: i tried it again too. With the #additionalres and the aar in additional libs folder. It is working fine on my device. Hmmm.... Click to expand... - I tried Samsung S7 ( Android 6.1 ) + Samsung Note 3 Neo ( Android 5.1 ) - Library is SwitchButtonV1.5.zip Same problem.
DonManfred said: i tried it again too. With the #additionalres and the aar in additional libs folder. It is working fine on my device. Hmmm.... Click to expand... - I tried Samsung S7 ( Android 6.1 ) + Samsung Note 3 Neo ( Android 5.1 ) - Library is SwitchButtonV1.5.zip Same problem.
DonManfred Expert Licensed User Longtime User Nov 23, 2016 #22 This is the content of the Resourcefolder. There are just drawables. No other xml... Attachments Resource.zip Resource.zip 15.2 KB · Views: 589
DonManfred Expert Licensed User Longtime User Nov 23, 2016 #23 MarcoRome said: I tried Samsung S7 Click to expand... Same here
MarcoRome Expert Licensed User Longtime User Nov 23, 2016 #24 DonManfred said: This is the content of the Resourcefolder. There are just drawables. No other xml... Click to expand... This Resource folder is right. In Resource that you have in example are present also folder value and color into Resource. This is conflict. Now work
DonManfred said: This is the content of the Resourcefolder. There are just drawables. No other xml... Click to expand... This Resource folder is right. In Resource that you have in example are present also folder value and color into Resource. This is conflict. Now work
peacemaker Expert Licensed User Longtime User Jul 14, 2017 #25 But ... it's impossible to get the current state of the switch ? If to use several switches - how to save the user selection ? UPD: OK, a common extra map of values can be updated by events... Last edited: Jul 15, 2017
But ... it's impossible to get the current state of the switch ? If to use several switches - how to save the user selection ? UPD: OK, a common extra map of values can be updated by events...
DonManfred Expert Licensed User Longtime User Jul 15, 2017 #26 peacemaker said: But ... it's impossible to get the current state of the switch ? If to use several switches - how to save the user selection ? Click to expand... As i lost my source a few months ago i do not have the source so i cant answer this. BUT i did a fast new wrap for it. Try the version attached please Attachments SwitchButtonV2.0.zip SwitchButtonV2.0.zip 32.6 KB · Views: 538 SwitchButtonEx.zip SwitchButtonEx.zip 26.4 KB · Views: 611 Last edited: Jul 15, 2017
peacemaker said: But ... it's impossible to get the current state of the switch ? If to use several switches - how to save the user selection ? Click to expand... As i lost my source a few months ago i do not have the source so i cant answer this. BUT i did a fast new wrap for it. Try the version attached please
peacemaker Expert Licensed User Longtime User Jul 15, 2017 #27 DonManfred said: Try the version v.2.00 attached please Click to expand... setThumbSize, performClick were removed why ? "Checked" is with getter now, but no use to test, as above are removed ((
DonManfred said: Try the version v.2.00 attached please Click to expand... setThumbSize, performClick were removed why ? "Checked" is with getter now, but no use to test, as above are removed ((
DonManfred Expert Licensed User Longtime User Jul 15, 2017 #28 peacemaker said: setThumbSize, performClick were removed why ? Click to expand... You should ask another way.... It was not REMOVED. It was forgotten. Attachments SwitchButtonV2.1.zip SwitchButtonV2.1.zip 32.7 KB · Views: 566
peacemaker said: setThumbSize, performClick were removed why ? Click to expand... You should ask another way.... It was not REMOVED. It was forgotten.
peacemaker Expert Licensed User Longtime User Jul 15, 2017 #29 v.2.1: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException Caused by: java.lang.NoSuchFieldError: No static field colorAccent of type I in class Lcom/kyleduo/switchbutton/R$attr; or its superclasses (declaration of 'com.kyleduo.switchbutton.R$attr' appears in base.apk)
v.2.1: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException Caused by: java.lang.NoSuchFieldError: No static field colorAccent of type I in class Lcom/kyleduo/switchbutton/R$attr; or its superclasses (declaration of 'com.kyleduo.switchbutton.R$attr' appears in base.apk)
DonManfred Expert Licensed User Longtime User Jul 15, 2017 #30 I guess you app needs to use AppCompat andbe configured correctly. Did you try my example?
peacemaker Expert Licensed User Longtime User Jul 15, 2017 #31 Yes, seems AppCompat helped... THanks ! It needs to understand what this is...
Csaba Balogh Member Licensed User Jan 3, 2019 #32 Hi DonManfred, Great library! However I cannot find SetText property anymore Is that removed? Thx!
M Matteo Giorgini Member Licensed User Longtime User May 12, 2020 #33 Hi DonManfred! I would like to use your library on my project (v. 2.10). I downloaded the sample, but on my project I don't use AppCompat. This is a problem because without this reference my APP crashes at start. Can I use SwitchButton "without" AppCompat? How do I do? Thanks in advance to replay. Matteo
Hi DonManfred! I would like to use your library on my project (v. 2.10). I downloaded the sample, but on my project I don't use AppCompat. This is a problem because without this reference my APP crashes at start. Can I use SwitchButton "without" AppCompat? How do I do? Thanks in advance to replay. Matteo
DonManfred Expert Licensed User Longtime User May 12, 2020 #34 Matteo Giorgini said: "without" AppCompat? Click to expand... No
Alexander Stolte Expert Licensed User Longtime User May 12, 2020 #35 Matteo Giorgini said: "without" AppCompat? How do I do? Click to expand... Try the B4XSwitch if you want to avoid AppCompat.
Matteo Giorgini said: "without" AppCompat? How do I do? Click to expand... Try the B4XSwitch if you want to avoid AppCompat.
M Matteo Giorgini Member Licensed User Longtime User May 13, 2020 #36 Alexander Stolte said: Try the B4XSwitch if you want to avoid AppCompat. Click to expand... Thanks! I used this component and it's ok! But... why I can't resize it? It's a limitation? Bye Matteo
Alexander Stolte said: Try the B4XSwitch if you want to avoid AppCompat. Click to expand... Thanks! I used this component and it's ok! But... why I can't resize it? It's a limitation? Bye Matteo
Alexander Stolte Expert Licensed User Longtime User May 13, 2020 #37 Matteo Giorgini said: But... why I can't resize it? It's a limitation? Click to expand... Make a new thread please.
Matteo Giorgini said: But... why I can't resize it? It's a limitation? Click to expand... Make a new thread please.