B4A Library Material AnimatedSwitch

AnimatedSwitch
Version:
1

This is a wrapper for this Github project.
  • AnimatedSwitch
    Fields:
    • ba As BA
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • 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)
    • check
    • toggle
    • unCheck
    Properties:
    • Background As Drawable
    • BallColorPress As Int
    • BallColorRelease As Int
    • BallShadowColor As Int
    • BaseColorPress As Int
    • BaseColorRelease As Int
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Margin As Int
    • PressIcon As Bitmap
    • PressIconRes As String [write only]
    • ReleaseIcon As Bitmap
    • ReleaseIconRes As String [write only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int

B4X:
    Activity.LoadLayout("Layout1")
    aSwitch1.BallColorPress = Colors.Red
    aSwitch1.BallColorRelease = Colors.Green
    aSwitch1.BaseColorPress = Colors.Blue
    aSwitch1.BaseColorRelease = Colors.Magenta

    aswitch2.BallColorPress = Colors.Cyan
    aswitch2.BallColorRelease = Colors.DarkGray
    aswitch2.BaseColorPress = Colors.Cyan
    aswitch2.BaseColorRelease = Colors.Blue
    aswitch2.PressIconRes = "ic_delete_deep_purple_500_36dp"
    aswitch2.ReleaseIconRes = "ic_delete_blue_500_36dp"

    aSwitch3.BallColorPress = Colors.Gray
    aSwitch3.BallColorRelease = Colors.DarkGray
    aSwitch3.BaseColorPress = Colors.Gray
    aSwitch3.BaseColorRelease = Colors.DarkGray
    aSwitch3.PressIconRes = "ic_stop_deep_orange_500_36dp"
    aSwitch3.ReleaseIconRes = "ic_play_arrow_white_36dp"

sw1.jpg
sw1press.jpg

sw2.jpg
sw2press.jpg

sw3.jpg
sw3press.jpg



This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work) :)
 

Attachments

  • AnimatedSwitchEx.zip
    14.8 KB · Views: 555
  • libAnimatedSwitchV1.0.1.zip
    35.2 KB · Views: 458
  • libAnimatedSwitchV1.0.2.zip
    36.2 KB · Views: 521
Last edited:

Kwame Twum

Active Member
Licensed User
Longtime User
1. Is there a way to get the check state of the switch?
doesn't seem to be among the properties...

2. What does switch.ba do?
 
Top