Android Question xCustomListView - LongClick

Discussion in 'Android Questions' started by LucaMs, May 13, 2019.

  1. LucaMs

    LucaMs Expert Licensed User

    Unlike the ListView (and the many apps), LongClick on a Label inside a xCustomListView is not detected (nor, even less, on other View types).

    Furthermore, the behavior is different in b4a and b4j; in b4a only the click event of the label fires, in b4j, after this event, also the LongClick of xCLV starts.

    However, apart from the different behavior between the two platforms, the main point is that the LongClick on the Label should happen as in a normal ListView.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    I guess that you haven't consumed the mouse event. However this is again not the correct place to discuss it as it is a B4J question.

    The handling of touch events in views inside ScrollView (CustomListView = ScrollView) is more sensitive as in many cases the ScrollView intercepts the gesture as a scrolling gesture.

    However I just tried it and it works fine here:
    Code:
    Sub Globals
       
    Private xui As XUI
       
    Private CustomListView1 As CustomListView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
       
    Activity.LoadLayout("1")
       
    For i = 1 To 100
           
    Dim lbl As Label
           lbl.Initialize(
    "lbl")
           lbl.Text = 
    "AAAA"
           
    Dim x As B4XView = lbl
           x.SetTextAlignment(
    "CENTER""CENTER")
           x.TextColor = xui.Color_Black
           
    Dim p As B4XView = xui.CreatePanel("")
           p.SetLayoutAnimated(
    000100%x100dip)
           p.AddView(lbl, 
    00100dip100dip)
           CustomListView1.Add(p, 
    "")
       
    Next
    End Sub

    Sub lbl_Click
       
    Log("click")
    End Sub

    Sub lbl_LongClick
       
    Log("long")
    End Sub

    Sub CustomListView1_ItemLongClick (Index As Int, Value As Object)
       
    Log("CLV Long")
    End Sub
     
  3. LucaMs

    LucaMs Expert Licensed User

    No, maybe I explained badly but my question is mainly about the difference between the long click (tap) on a label inside a ListView and in a label inside a xCustomListView.

    [I have yet to read the rest :)]
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice