Hi,
maybe someone could help me to explain me what I'm doing wrong that I receiving this behavior with CLVswipe and wrong positioned CLV on the page.
Here the screenshot thru design time, here looks the positioning of the clv element correct.
But if I execute it on iPhone emulator its look incorrectly positioned/adjusted.
when I comment out this line of code, then it works fine.
here my complete example code.
And attached the Project.
Best Regard and thanks in advanced for any kind of help
Michael
maybe someone could help me to explain me what I'm doing wrong that I receiving this behavior with CLVswipe and wrong positioned CLV on the page.
Here the screenshot thru design time, here looks the positioning of the clv element correct.
But if I execute it on iPhone emulator its look incorrectly positioned/adjusted.
when I comment out this line of code, then it works fine.
B4X:
swipe.Initialize(clv1, Me, "swipe")
here my complete example code.
B4X:
'Code module
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#Target: iPhone, iPad
#ATSEnabled: True
#MinVersion: 8
#End Region
Sub Process_Globals
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private xui As XUI
Private swipe As CLVSwipe
Private lblPullToRefresh As B4XView
Private ProgressBar1 As B4XView
Private clv1 As CustomListView
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("Page1")
NavControl.ShowPage(Page1)
swipe.Initialize(clv1, Me, "swipe")
swipe.ActionColors = CreateMap("Delete": xui.Color_Red, "Do Something Else": xui.Color_Green, _
"Action 1": xui.Color_Red, "Action 2": xui.Color_Blue, "Action 3": xui.Color_Yellow)
Dim PullToRefreshPanel As B4XView = xui.CreatePanel("")
PullToRefreshPanel.SetLayoutAnimated(0, 0, 0, 100%x, 70dip)
PullToRefreshPanel.LoadLayout("PullToRefresh")
swipe.PullToRefreshPanel = PullToRefreshPanel
fillclv
End Sub
Sub fillclv
' clv1.AddTextItem("Row 1", 1)
clv1.AddTextItem("Row 1", swipe.CreateItemValue("", Array("Delete", "Do Something Else")))
clv1.AddTextItem("Row 2", swipe.CreateItemValue("", Array("Delete", "Do Something Else")))
clv1.AddTextItem("Row 3", swipe.CreateItemValue("", Array("Delete", "Do Something Else")))
' clv1.Add(clv1_CreateItem,1)
clv1.Add(clv1_CreateItem,swipe.CreateItemValue("", Array("Delete", "Duplizieren")))
clv1.Add(clv1_CreateItem,swipe.CreateItemValue("", Array("Delete", "Duplizieren")))
Dim ClvSize As Int = clv1.Size
XUIViewsUtils.AddStubToCLVIfNeeded(clv1, clv1.DefaultTextBackgroundColor)
If clv1.Size > ClvSize Then
clv1.ResizeItem(clv1.Size - 1, clv1.GetPanel(clv1.Size - 1).Height + 20dip)
End If
End Sub
Sub clv1_CreateItem() As B4XView
Dim varPanel As B4XView = xui.CreatePanel(""), varColor As Int
varPanel.LoadLayout("line")
varPanel.Height = 80
Return varPanel
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
Sub clv1_ItemClick (Index As Int, Value As Object)
swipe.CloseLastSwiped
End Sub
Sub clv1_ScrollChanged (Offset As Int)
If xui.IsB4i Then
swipe.ScrollChanged(Offset)
End If
swipe.CloseLastSwiped
End Sub
Sub swipe_ActionClicked (Index As Int, ActionText As String)
Log($"Action clicked: ${Index}, ${ActionText}"$)
If ActionText = "Delete" Then
clv1.RemoveAt(Index)
Else If ActionText = "Do Something Else" Then
Dim p As B4XView = clv1.GetPanel(Index)
Dim lbl As B4XView = p.GetView(0)
lbl.Text = "Done!!!"
End If
End Sub
Sub swipe_RefreshRequested
lblPullToRefresh.Text = "Loading..."
ProgressBar1.Visible = True
'example!!!
Sleep(3000)
clv1.Clear
fillclv
swipe.RefreshCompleted '<-- call to exit refresh mode
lblPullToRefresh.Text = "Pull to refresh"
ProgressBar1.Visible = False
End Sub
And attached the Project.
Best Regard and thanks in advanced for any kind of help
Michael
Attachments
Last edited: