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

  • Example1.zip
    20.8 KB · Views: 508
  • Example2.zip
    77.3 KB · Views: 470
  • Example3.zip
    64.7 KB · Views: 529
  • Library.zip
    3.4 KB · Views: 614
  • UISwitch Models.zip
    110.2 KB · Views: 558
  • Screenshot1.png
    Screenshot1.png
    82.7 KB · Views: 643
  • Screenshot2.png
    Screenshot2.png
    23 KB · Views: 596
  • Screenshot3.png
    Screenshot3.png
    52.7 KB · Views: 604
  • GoogleToogles.zip
    1.7 KB · Views: 407
Last edited:

CidTek

Active Member
Licensed User
Longtime User
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.
 

CidTek

Active Member
Licensed User
Longtime User
Here is a couple more png files that are Blackberry themed.
 

Attachments

  • Blackberry Toggles.zip
    13.2 KB · Views: 331

LucaMs

Expert
Licensed User
Longtime User
The "circles" in the main image are almost perfect, in the other pictures posted no.

I am afraid that there is no method to scale images without distorting them.
I think we should use the folders for the various resolutions such as Google suggests and this is really a nuisance.
 

CidTek

Active Member
Licensed User
Longtime User
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!
 

Silv

Member
Licensed User
Longtime User
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:

Silv

Member
Licensed User
Longtime User
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.
 

hears

Active Member
Licensed User
Longtime User
i have tried ,this switch cannot set to off by this code ,if setposition always display ON.
why ?

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