B4A Library [B4X][XUI] ImageSlider

Status
Not open for further replies.
ImageSlider custom view is compatible with B4A, B4i and B4J.

SS-2017-12-11_18.00.51.jpg


Features:
  • Three transition types: horizontal, vertical and fade. Configured in the visual designer.
  • Images are centered and not distorted.
  • Next and previous images are cached.
  • Sliding gestures.
  • Flexible data source.
  • Cross platform.

Usage:

1. Add ImageSlider with the designer.
2. Set the number of images:
B4X:
ImageSlider1.NumberOfImages = 4
3. Implement the GetImage event. This is a resumable sub.
You should return a B4XBitmap based on the index.
B4X:
Sub ImageSlider1_GetImage (Index As Int) As ResumableSub
   Return xui.LoadBitmapResize(File.DirAssets, $"test_${Index + 1}.jpg"$, _
        ImageSlider1.WindowBase.Width, ImageSlider1.WindowBase.Height, True)
End Sub
In this example the images are loaded from the assets folder.

4. Call ImageSlider.NextImage or PrevImage.

A B4J project with the ImageSlider class: www.b4x.com/b4j/files/ImageSlider.zip

A B4A example where the http requests are made from the starter service is available here: https://www.b4x.com/android/forum/t...sing-when-the-slider-is-on.95779/#post-604705

Updates

V1.11 - Fixes the dot indicator offset.
V1.10 - adds a dot indicator and fixes a bug: https://www.b4x.com/android/forum/threads/b4x-xui-imageslider.87128/page-2#post-618398

The latest version is included in the B4J project.
 
Last edited:

ykucuk

Well-Known Member
Licensed User
Longtime User
I'm trying to create social feed as Instagram. I need many image sliders to add customlistview.

How I should change Get image function for the multi-image slider, Can I use "sender"?

Thanks
 

ykucuk

Well-Known Member
Licensed User
Longtime User
Sounds like you should use xCustomListView with lazy loading of the images.
Yes. My problem is not loading too many photos. I ll try explain .

I added 20 panels into xCustomListView.

Each panel has an imageslider view inside with different photos.

My questions :

1- is gesture working with imageslider?
2- how can i set getimage function for all this imagesliders ?
 

Christian García S.

Active Member
Licensed User
Hello @Erel,

I implemented CustomListView with multiple ImageSliders (https://www.b4x.com/android/forum/threads/b4x-customlistview-with-multiple-imagesliders.97219/), based on this library and it works great.

I am with an application that needs to show several promotional items in the slider, and I would like it when I click on these items to go to the description of each one, at this moment as I saw it there is only one event (ItemClick) in custom list view, but when you click on the middle of the slider it does not do anything.

Can you please help us with click event?

Thanks
 
Status
Not open for further replies.
Top