B4A Library UISwitch - Switch Control (iOS like)

Alberto Iglesias

Well-Known Member
Licensed User


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



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



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.basic4ppc.com/android/forum/threads/lib-animationplus.21313/
 

Attachments

Last edited:

CidTek

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

LucaMs

Expert
Licensed 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.
 

LucaMs

Expert
Licensed User
It don't work on B4A v3.20

java.lang.NoSuchMethodError: anywheresoftware.b4a.BA.isShellModeRuntimeCheck
 

CidTek

Active Member
Licensed 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
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
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
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