Android Question xCustomListView pressed color not working

techknight

Well-Known Member
Licensed User
Longtime User
I am using xCustomListView with the CustomLayoutDialog as in the example somewhere in this forum.

Trouble is, the pressed color doesn't do anything. I even added it in code, and no difference. So when I tap on an item, or hold it, there is no feedback as nothing changes. Not sure why.

thoughts?

CLVDialog is declared in the globals

B4X:
            'Display all of the available scoreboards that we can connect to.
            Dim ScoreboardDialog As CustomLayoutDialog
            ScoreboardDialog.ShowAsync("Choose Scoreboard", "", "", "", Null, True)                'Initialize the dialog to be displayed
            ScoreboardDialog.SetSize(60%x, 400dip)
            Wait For Dialog_Ready(pnl As Panel)
            pnl.LoadLayout("CustomDialogLayout")                                                'Load the layout which contains the list view.
            CLVDialog.PressedColor = Colors.ARGB(255, 0x7E, 0xB4, 0xFA)
 

techknight

Well-Known Member
Licensed User
Longtime User
is the click event working?
If no, then you have the answer.

Yes, it is:

B4X:
               Wait For CLVDialog_ItemClick (Index As Int, Value As Object)
              Log("Selected item: " & Value)
               ScoreboardDialog.CloseDialog(DialogResponse.POSITIVE)

1651602472580.png
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Does the custom layout dialog file has a panel that covering the background?

B4X:
pnl.LoadLayout("CustomDialogLayout")

i mean this layout

No, the layout is simply containing the CustomListView:
1651607968574.png



This is the entire code block, thats it:
B4X:
            'Display all of the available scoreboards that we can connect to. 
            Dim ScoreboardDialog As CustomLayoutDialog
            ScoreboardDialog.ShowAsync("Choose Scoreboard", "", "", "", Null, True)                'Initialize the dialog to be displayed
            ScoreboardDialog.SetSize(60%x, 400dip)
            Wait For Dialog_Ready(pnl As Panel)
            pnl.LoadLayout("CustomDialogLayout")                                                'Load the layout which contains the list view.
            CLVDialog.PressedColor = Colors.ARGB(255, 0x7E, 0xB4, 0xFA)
            'Lets sort through the available scoreboards and determine which ones are applicable to us. 
            Dim SportIdentified As Boolean = False
            For I = 0 To ConfigDB.NumScoreboards-1    'Loop through each retrieved scoreboard from the database 
                
                SportIdentified = False
                If ConfigDB.Scoreboards(I).Sport <> "" And ConfigDB.Scoreboards(I).Sport.Contains(",") = True Then     'We need to make sure we have proper sport configurations. 
                    Dim Sports() As String = Regex.Split(",", ConfigDB.Scoreboards(i).Sport)        'Grab all supported sport types. 
                    For Each Sport As String In Sports            'Iterate through the array of available sport IDs
                        If Common.Val(Sport) = ScoreEngine.GameOptions.Sport Then     'Bingo we have a sport that we are compatible with to operate in. 
                            SportIdentified = True
                            Exit    'Exit the iteration. 
                        End If
                    Next
                End If
                
                'Once we have a scoreboard that has a compatible sport, we need to add this scoreboard into the list of available scoreboards. 
                If SportIdentified = True Then 
                    If ConfigDB.Scoreboards(I).InUse = True Then     'The scoreboard is already in-use. 
                        CLVDialog.AddTextItem(ConfigDB.Scoreboards(I).FriendlyName & " - IN USE", I)
                    Else    'Scoreboard is available for use. 
                        CLVDialog.AddTextItem(ConfigDB.Scoreboards(I).FriendlyName, I)
                    End If
                End If
            Next
                    
            If CLVDialog.Size = 0 Then 'We didn't find any compatible scoreboards
                ScoreboardDialog.CloseDialog(DialogResponse.NEGATIVE)
                MsgboxAsync("There are currently no available scoreboards configured for your sport that you have selected. Please try again", "No compatible scoreboards found")
                Return        
            End If
                        
               Wait For CLVDialog_ItemClick (Index As Int, Value As Object)
              Log("Selected item: " & Value)
               ScoreboardDialog.CloseDialog(DialogResponse.POSITIVE)
 
Upvote 0

Addo

Well-Known Member
Licensed User
Longtime User
Addtextitem should allow the pressed color to be visible. The only way that can cause such behavior as far as i know when adding using additem and that layout that loaded to the item panel has a background panel in the layout file.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Addtextitem should allow the pressed color to be visible. The only way that can cause such behavior as far as i know when adding using additem and that layout that loaded to the item panel has a background panel in the layout file.

Well, I am using only addtextitem, not doing anything special other than that. I am lost as to whats going on. I also showed the screenshot of the layout file I am loading, the only control in there is the CLV.

I wonder if its a bug with CustomLayoutDialog?
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Was going to switch and try B4XDialog, but I dont know how to center it. since the CustomLayoutDialog is auto-centered.
 
Upvote 0
Top