Android Question xCustomListView item panels

Discussion in 'Android Questions' started by LucaMs, Jan 6, 2019.

  1. LucaMs

    LucaMs Expert Licensed User

    When I create a "b4xview panel" with rounded corners, it is ok if added directly to an Activity; if I pass (add) it to a xCustomListView, the corners are wrong:

    1b.jpg
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    Why aren't you using xCustomListView library?

    Complete code:
    Code:
    Sub Process_Globals
       
    Private xui As XUI
    End Sub

    Sub Globals
       
    Private CustomListView1 As CustomListView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
       
    Activity.LoadLayout("layMain")
       
    For i = 1 To 20
           
    Dim p As B4XView = xui.CreatePanel("")
           p.SetLayoutAnimated(
    000, CustomListView1.AsView.Width, 60dip)
           p.LoadLayout(
    "Item")
           CustomListView1.Add(p, 
    "")
       
    Next
    End Sub
    [​IMG]
     

    Attached Files:

    LucaMs likes this.
  3. LucaMs

    LucaMs Expert Licensed User

    I don't know :D


    Thanks, Erel, but I would like to show only the panels, with no background of any kind, like the middle panel of my example.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    There is no background at all in the example I've posted. You are seeing the activity gradient background.
     
    LucaMs likes this.
  5. LucaMs

    LucaMs Expert Licensed User

    ah, yes, now I saw.
    Well, by loading the layout it works well; by code not and I don't understand the reason.

    Thanks, Erel.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Use the designer. It will be simpler.

    The reason is that the item's base panel needs to be transparent. The inner panel can have round corners.
     
  7. LucaMs

    LucaMs Expert Licensed User

    Usually I use the layouts; this time I needed to do it by code, because an our friend prefers to do all by code ;)


    It's not clear for me, Erel, sorry :(.

    Is it impossible to create that "kind of panel" (transparent) by code and add it to the xCLV?

    Which inner panel do you refer to?

    In short, the only solution is to use the Designer?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    No.

    Same layout without designer:
    Code:
    Sub Activity_Create(FirstTime As Boolean)
       
    Activity.LoadLayout("layMain")
       
    For i = 1 To 20
           
    Dim p As B4XView = xui.CreatePanel("")
           p.SetLayoutAnimated(
    000, CustomListView1.AsView.Width, 60dip)
           
    Dim pp As B4XView = xui.CreatePanel("")
           pp.SetColorAndBorder(xui.Color_Blue, 
    2dip, xui.Color_White, 5dip)
           p.AddView(pp, 
    00, p.Width, p.Height)
           CustomListView1.Add(p, 
    "")
       
    Next
    End Sub
    Make sure to set the divider color to transparent.
     
    LucaMs likes this.
  9. LucaMs

    LucaMs Expert Licensed User

    umm no, it does not work:

    upload_2019-1-6_10-45-46.png

    upload_2019-1-6_10-47-10.png
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Change the custom view background alpha level to 0.
     
    LucaMs likes this.
  11. LucaMs

    LucaMs Expert Licensed User

    I tried also:

    Code:
    xCLVV.GetBase.Color = xui.Color_Transparent
        
    Dim sv As ScrollView = xCLVV.GetBase.GetView(0)
        sv.Color = 
    Colors.Transparent ' xui.Color_Transparent
        sv.Panel.Color = Colors.Transparent 'xui.Color_Transparent
    (where xCLVV is a xCV of course) without success.
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    The code I posted with the layout from post #2 works properly. You are seeing the activity background.
     
    LucaMs likes this.
  13. LucaMs

    LucaMs Expert Licensed User

    Dim b As B4XView = xCLVV.AsView
    b.Color = Colors.ARGB(0,0,0,0)

    Now it is perfect; now I just have to sleep, wake up and understand everything :D

    Thank you, Erel
     
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