This is a Beta version of before-after image comparison slider written completely in b4a.
Attached are the .jar and .xml files to be placed in additional libraries folder of b4a.
No extra jar files needed.
How to use:
1- Place a beforeAfterImgSlider in designer, give a name or leave default
2- Generate as a member with methods ( 'dragged' and 'ImagesSet' if needed)
2- Initialize two bitmaps ( before and after ) from two images as:
2- set Images:
beforeAfterImgSlider1.setImages(beforeBmp, afterBmp)
3- run
Methods , properties and events:
Methods:
-Initialize: no parameters
-SetImages: 2 parameters (beforeBMP , afterBMP)
Properties:
-ShowThumb: whether to show the thumb to drag the line between the two images (can be set in designer or at runtime).
-ThumbColor: the color of the thumb (can be set in designer or at runtime).
Events:
BeforeAfterImgSlider_Dragged (clipPosition as int): show how much of the before image is shown.
BeforeAfterImgSlider_ImagesSet: just to check if the two images are loaded (True or False).
Here is a Demo:
A demo example is attached.
A watermark (JK) is overlying the customview at time being.
Source code will be gladly presented on donation of $30. It took a lot of time to develop.
Edit: Example added.
Attached are the .jar and .xml files to be placed in additional libraries folder of b4a.
No extra jar files needed.
How to use:
1- Place a beforeAfterImgSlider in designer, give a name or leave default
2- Generate as a member with methods ( 'dragged' and 'ImagesSet' if needed)
2- Initialize two bitmaps ( before and after ) from two images as:
B4X:
Dim beforeBmp as Bitmap
beforeBmp.Initialize(File.DirAssets, "beforeImg.jpg")
Dim afterBmp as Bitmap
afterBmp.Initialize(File.DirAssets, "afterImg.jpg")
beforeAfterImgSlider1.setImages(beforeBmp, afterBmp)
3- run
Methods , properties and events:
Methods:
-Initialize: no parameters
-SetImages: 2 parameters (beforeBMP , afterBMP)
Properties:
-ShowThumb: whether to show the thumb to drag the line between the two images (can be set in designer or at runtime).
-ThumbColor: the color of the thumb (can be set in designer or at runtime).
Events:
BeforeAfterImgSlider_Dragged (clipPosition as int): show how much of the before image is shown.
BeforeAfterImgSlider_ImagesSet: just to check if the two images are loaded (True or False).
Here is a Demo:
A demo example is attached.
A watermark (JK) is overlying the customview at time being.
Source code will be gladly presented on donation of $30. It took a lot of time to develop.
Edit: Example added.
Attachments
Last edited: