Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does overlaying views work in Android?

In Android, i noticed that you can have a fixed view on top of another. For example, when you open your browser, and tap the search box, a keyboard prompt pops up (on top of a listview). However, notice that you can still scroll up and down on the listview without the keyboard going away. Like:

example showing keyboard overlaying the listview

would someone please explain (preferrably some sample code in addition) how this works?

What i'm trying to do is just have a custom listview that always has a floating navigation bar on top of the listview and also on the bottom of the list view (it's not actually a header/footer of the listview, it's more like a header/footer of the screen). It would be similar to the example i just described, where the user can interact with both the navigation bar as well as the listview "underneath" the nav bar.

I am somewhat new to Android development, so please be nice and provide a little bit of details if you would :) much thanks in advance!!

like image 786
David T. Avatar asked Dec 30 '25 02:12

David T.


1 Answers

whoops. looks like someone had a similar issue:

Layout Layers? Z-Axis?

and this post http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-by.html explains how FrameLayout works and also how works, which is an even better alternative.

FrameLayout lays object in a different Z-axis, so this is the solution i was looking for.

like image 87
David T. Avatar answered Jan 02 '26 20:01

David T.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!