B4A Library UISwitch - Switch Control (iOS like)

UISwitchTOP.jpg


This library was made based on UISwitch for IOS

Installation instructions:
- Copy the .xml and .jar files to your custom libraries folder
- Select in your REFERENCED LIBRARIES

UISwitch2.png


Version history:
V1.0 (First public release):
- Initial version

UISwitch1.png


UISwitch
Author:
Alberto Iglesias
Version: 1
  • UISwitch
    Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _asview As PanelWrapper
      Return Panel Object from UISwitch
    • _author As String
      Return the author of this library
    • _getposition As String
      Return the Position
    • _initialize (vCallback As Object, ev As String, Tag As String, Width As Int, Height As Int, Bitmap0 As BitmapWrapper, Bitmap1 As BitmapWrapper) As String
      Initializes the object. You can add parameters to this method if needed.

      Examples:

      Dim objBmp0 As Bitmap = LoadBitmap(File.DirAssets, "Model01_OFF.png")
      Dim objBmp1 As Bitmap = LoadBitmap(File.DirAssets, "Model01_ON.png")
      objUISwitch3.Initialize(Me,"objUISwitch","3333333",154dip,54dip,objBmp0,objBmp1)
    • _setposition (pPosition As Int) As String
      Set Position (0 or 1)
    • _version As String
      Return the version of this library


This library use the AnimationPlus like dependence, if you don´t have, do the download from
http://www.b4x.com/android/forum/threads/lib-animationplus.21313/
 

Attachments

Last edited:
Incredible! You must have been up all night working on this and I thank you very much!

I will be working with the samples tonight and I will post back some feedback.
 
I have added this custom view to my app to replace checkboxes and it works perfect and looks great. Just remember to keep the height and width ratios correct when using any image or else it will get distorted.

I am confused by the AnimationPlus requirement as it doesn't seem to be needed and the sample projects didn't reference it either.

Thanks again for a great library!
 
Hi Alberto, is your library works fine with Android 5? I just run yours examples and i see only the blank screen.
Thanks
 
Last edited:
Oh i fixed it, i just forget to update my AnimationPlus library. Would be great if in new versions of B4A existing libraries start updating automatically.
 
i have tried ,this switch cannot set to off by this code ,if setposition always display ON.
why ?

objUI1.SetPosition(0)
objUI2.SetPosition(1)
 
Back
Top