B4A Library [B4X] [XUI] AS ViewPager based on xCustomListView

angel_

Well-Known Member
Licensed User
Longtime User
Thank you very much, it really works better than before but it still happens if the screen has a long list of elements (in this case a text list), it also happens frequently if we scroll from top to bottom but it is somewhat less problematic
 

Alexander Stolte

Expert
Licensed User
Longtime User
Thank you very much, it really works better than before but it still happens if the screen has a long list of elements (in this case a text list), it also happens frequently if we scroll from top to bottom but it is somewhat less problematic
strange, if the y value is greater than the x value, then it should stay on the side and not change sides. Does it stay on the side?
 

Alexander Stolte

Expert
Licensed User
Longtime User
I have a similar problem with a paused project where I use 2 ViewPagers, one Horizontal and the other Vertical and whenever I swipe horizontally the vertical one feels addressed too.
 

angel_

Well-Known Member
Licensed User
Longtime User
I have also observed (now on Android), that if you do the fast (unnatural) swipe up or down it jumps to another tab [v1.21]
 
Last edited:

angel_

Well-Known Member
Licensed User
Longtime User
I have also observed (now on Android), that if you do the fast (unnatural) swipe up or down it jumps to another tab [v1.21]
This is fixed, thank you

But another problem happens, if I change the focus (by code with the event) when pressing the tab, the tab line moves to the selected tab, returns to the previous one and finally returns to the selected tab
 

Alexander Stolte

Expert
Licensed User
Longtime User
I had the same problem, because you set the tab in the "PageChange" event, but at the same time the TabClick event is triggered.

The solution is to change the TabMenu tab in the "PageChange" event without triggering the event.

B4X:
Private Sub ASTabMenu1_TabClick(index As Int)
    ASViewPager1.CurrentIndex = index
End Sub

Private Sub ASViewPager1_PageChange(Index As Int)
    ASTabMenu_horizontal.SetTab(Index,False,False) 'with event = false
End Sub
 

angel_

Well-Known Member
Licensed User
Longtime User
I have tried this solution but the same thing happens
 
hi all
its possible add CustomListView in page !?
i have some error like this

code
B4X:
    Dim tmp_xpnl As B4XView = xui.CreatePanel("")
    tmp_xpnl.LoadLayout("xclv")
    tmp_xpnl.SetLayoutAnimated(0,0,0,ASViewPager1.Base.Width,ASViewPager1.Base.Height)
    tmp_xpnl.BringToFront
    ASViewPager1.AddPage(tmp_xpnl,"")

    xclvitem.AddTextItem("1Aaaa" & CRLF & "Bbbb", "b")


*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Panel size is unknown. Layout may not be loaded correctly.
Error occurred on line: 34 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1055)
at com.as.viewpager.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1060)
at com.as.viewpager.b4xpagesmanager._showpage(b4xpagesmanager.java:417)
at com.as.viewpager.b4xpagesmanager._addpage(b4xpagesmanager.java:245)
at com.as.viewpager.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:259)
at com.as.viewpager.b4xpagesmanager._initialize(b4xpagesmanager.java:165)
at com.as.viewpager.main._activity_create(main.java:408)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.as.viewpager.main.afterFirstLayout(main.java:105)
at com.as.viewpager.main.access$000(main.java:17)
at com.as.viewpager.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6816)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
... 24 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
... 25 more
Caused by: java.lang.IllegalArgumentException: Layout: -20 < 0
at android.text.Layout.<init>(Layout.java:187)
at android.text.StaticLayout.<init>(StaticLayout.java:478)
at android.text.StaticLayout.<init>(StaticLayout.java:464)
at android.text.StaticLayout.<init>(StaticLayout.java:442)
at android.text.StaticLayout.<init>(StaticLayout.java:422)
at anywheresoftware.b4a.objects.StringUtils.MeasureMultilineTextHeight(StringUtils.java:50)
at b4a.example3.customlistview._createlabel(customlistview.java:230)
at b4a.example3.customlistview._insertattextitem(customlistview.java:702)
at b4a.example3.customlistview._addtextitem(customlistview.java:78)
at com.as.viewpager.b4xmainpage._b4xpage_created(b4xmainpage.java:105)
... 27 more
** Activity (main) Resume **
 

Alexander Stolte

Expert
Licensed User
Longtime User
You need to add first the width/height and then load the layout:
B4X:
Dim tmp_xpnl As B4XView = xui.CreatePanel("")
tmp_xpnl.SetLayoutAnimated(0,0,0,ASViewPager1.Base.Width,ASViewPager1.Base.Height)
tmp_xpnl.LoadLayout("xclv")
 

angel_

Well-Known Member
Licensed User
Longtime User
Any improvement about this?
But another problem happens, if I change the focus (by code with the event) when pressing the tab, the tab line moves to the selected tab, returns to the previous one and finally returns to the selected tab
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
I'm using ASViewPager in a B4J project
I'm probably not handling resize correctly, because when I resize the window containing the ASViewPager, all other views resize correctly, but the content of the ViewPager itself is unaffected
What am I missing?
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
Make a new thread and make a example project what the issue shows, thanks.
here it is: the sample is based on your own example
thank you
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Hi Alex,

there is a Property to scroll to page without effects ?, to move from a page to another without effects,
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…