Android Question [Solved] Challenged by listview display (want on top)

Albert Kallal

Active Member
Licensed User
I have a view. Buttons panels etc on it.

I want to hit a button, display listview, user select. (all standard fair).

However, I am looking for a better approach then what I am doing now.
When the listview is displayed, it don't cover up what's on the current form view.

So, say I have this:

So, in above, the button is clicked - display a listview.

And when I display the listview, I get this:


So, those buttons are being mean to me! - I give them all care and love!

So, I figure, ok, put the listview in a panel, load the listview, display the panel, let user select, and then hide the panel.

This seems to be a "bit more" code and work then it should be. (my spider sense suggests I writing too much code).

For some reason some of the panels/buttions show on top.

So, I created the panel with designer, but not the listview. (did not seem worth it to add it)
(probably should adopt and assume I'll create both in code in the future.).

The code snip I have is this:
Sub cmdSelTable_Click
    ' assume valid connection
    ' query database for all tables
    Dim strSQL As String = "SELECT TABLE_NAME FROM " & txtDatabase.Text & ".INFORMATION_SCHEMA.TABLES " & _
                            "WHERE TABLE_TYPE = 'BASE TABLE'"
    Dim rst As JdbcResultSet
    ProgressBar1.Visible = True
    ListView1.Top = 0%x
    'ListView1.Height = 100%x
    ListView1.Width  = 100%y  
    ListView1.SingleLineLayout.ItemHeight = 40dip
        Dim sf As Object = Main.mysql.ExecQueryAsync("mysqlWAIT", strSQL ,Null)
        Wait For (sf) mysqlWAIT_QueryComplete(Success As Boolean,   rst As JdbcResultSet)
        If Success Then
            Dim MyRowCount As Int = 0
            ListView1.AddSingleLine("Select Table Name")
            Dim s As String = ""
            Do While rst.NextRow
                MyRowCount = MyRowCount + 1
                s = rst.GetString(rst.GetColumnName(0))
                'Sleep(0)        ' comment out if table sizes are to be  small (< 200 reocrds)
            pnlListView1.Top = 0%y
            pnlListView1.Height = 100%y
            pnlListView1.Width = 100%x
            pnlListView1.Visible = True
            pnlListView1.AddView(ListView1,0,0,100%x, 100%y)
        End If
        Success = False
    End Try
ProgressBar1.Visible = False
End Sub

Now, I expect over time (as get better with B4A) to use and have quite a few "selects" on a typical view with several
buttons that have the design pattern of:

Hit a button - select a value, hide the listview.

So two issues:
Am I writing too much code here to display/hide of the panel for a listview?
(a better approach is welcome).

How to ensure that buttons etc. on the view don't show though or on top of the panel?
(can/should I dump the panel idea?)

I can live with the amount of code and effort to deal with a panel to display the listview, but I'll need to solve the buttons and "other" things displaying on the view when they should simple appear behind the panel.

I can struggle forward here and start adding code to hide the buttons - , but my spider sense suggests I need to adopt a better approach then just "code" my way through this and whack everything with a big hammer.

So I'm am hitting some walls here with things and objects on that view not being covered when I turn on that panel.

Ideal would be:
ListView.OnTopOfEverything = true

(rather not need a panel at all here)


Any better way to hide and not show the cute lovable buttons that are fighting me in a nasty way today?

Albert D. Kallal
Edmonton, Alberta Canada
Last edited:


Licensed User
Longtime User
It would be much easier to help you if you posted your project as a zip file!


Do you really think that with the information you give we could help!
Sorry, but I can't.
With a project we see what exactly you have done and how, and we could test it in the same conditions as you do and suggest a concrete solution.
Upvote 0

Albert Kallal

Active Member
Licensed User
Sure, no problem.

The basic issue as outlined above is that the buttons show though the listview.

I simply want the buttons and everything in the view to be hidden during the select from listview.
(or the listview to show on top)

Or I am open to other approaches (such as my panel attempt that I failed rather badly at ;-) ).
I seen a lot of selects on Android tends to work this way.
(heck, even selects on a browser tend to do this (especially if they made the site with bootstrap).

So the problem:
Display of the list to select, and nothing else on the form.

So, I am hunting and looking for some ideas as to how this effect is achieved.

(or better said how I should approach and solve this issue).

The attached sample re-produces this problem (ie: buttons and objects on the view show during the selection process - I want them hidden).

The sample has two buttons:
Button 1 - displays the listview (but buttons/objects on the view still show through like my screen shot).

Button 2 - this is a attempt to hide things by using a panel. So, I display a panel, and add listview to that panel.
And again the hope was that buttons and general objects on the view would be hidden during the selection from the listview.

Albert D. Kallal
Edmonton, Alberta Canada


    9.4 KB · Views: 147
Upvote 0


Licensed User
Longtime User
Here you are.
You need to put the ListView onto the Panel.
And add a dummy event for the Panel to consume it, therefore no event is transmitted to underlying views.

Attached a modified version.


    9.4 KB · Views: 148
Last edited:
Upvote 0

Albert Kallal

Active Member
Licensed User
Thank you so kindly (posting a working fix for me is certainly a silver platter response and above the call of duty on your part).

So, I went back to my sample. I also had a panel.

So, it took me a bit of time to figure out why your panel worked all happy and just fine
(as I expected and assumed it should).

Wonders of wonders? It is the Elevation!

I simply overlooked that setting. And by overlooked?
Well, I mean I simply did not spend time to look up, learn about, or note and figure out what that Elevation setting does (very obvious now!).

So, setting panel elevation to be "higher" is what I was missing.

As long as I can look, read, learn, and move forward?

All is fine!

While Elevation might be a minor feature to most here?
Well it is something I ignored and did not know about, and did not learn about!
You can hear a BIG bell going ding dong between my ears!

I am happy to just drop in a few buttons on a view.
I'll then just toss a panel up in the corner or bottom - some out of mind out of way place!
(saves some lines of code to setup the gravity and what not).

The listviews? Hum, might declare - might use desinger.

So, with this?
I can have 2-3 listview selects on a form - they can all use the one panel.

The issue of events etc.? They are for the most part just fine in the activity.

Button on view.
Generate button click event.
Show panel, user selects, hide panel

I am happy!

It all makes sense now. See, I am still giving a group hug to those cute buttons and B4A did not let me down!

Alberts rule:
If something seems too hard, is taking too much code? It means I am doing it wrong or I have more to learn!

Again thanks!
Albert D. Kallal
Edmonton, Alberta Canada
Upvote 0

Albert Kallal

Active Member
Licensed User
Check B4XPreferenceDialog. It will be trivial to create such form.

Thank you. And I finally looked at some of the built in simple dialogs we have. To do a mult-select if I have a list?

This 3 lines of code would have done all I ask for:

    oList = InputMultiList(MySelList,"Select")

And for a single select, we have this:
    InputListAsync(MySelList,"Select a item", 0,True)
    Wait For InputList_Result (IntSel As Int)

both above are rather nice - little code, and are standard android selectors - VERY nice.

Check B4XPreferenceDialog. It will be trivial to create such form.

The simple issue is that B4A is a like a new fangled bread maker.
Just did not know it has options to also make tasty blueberry muffins - but I have to read the manual!

Still VERY happy about learning Elevation. (I was doing a right click - bring to front!! - too much .net and Access thinking here!!!).

I'll spent some time with the B4XPreferenceDialog. They again look to be most results for the least amount of efforts.
And once a few are done, then they can be re-used though out the app - rather nice.

Again, thanks to all here,
Albert D. Kallal
Edmonton, Alberta, Canada
Upvote 0