views:

49

answers:

1

I have seen numerous applications that use layering in their layouts. When I speak of layering I am referring to layers in the z-axis relative to the view of the user. One such app is the Craigslist Notification app where on top of the listView there is a plus sign near the bottom to allow user access to adding an additional list item.

In my case, I am successfully using a GestureListener to turn pages. Works well, but I would like to superimpose a transparent right and left arrow png on the edges of the pages if there are pages back or forward of the one the user is currently on.

I have searched, but not quite sure how to have 2 elements of a Layout consume the same space simultaneously. In this case you have the content of the page (layout), and the need for something on top of (z-axis) of that layout.

Can someone point me in the right direction?

Appreciate.

/r

A: 

Try using FrameLayout.

FrameLayout always places things one on top of the other and always in reference to the upper lefthand corner, so you'll need to use separate layouts inside of FrameLayout to place your objects where you want the on the screen.

Remember that android will put things into your layout in the order that they are list, so place objects at the bottom of the layout that you want near the top of your display.

Here's a quick example (don't forget to add proper xml header data to the top node):

<FrameLayout>
  <RelativeLayout>
    <!--  Place the objects you want on the bottom here -->
  </RelativeLayout>


  <RelativeLayout>
    <!--  Place the objects you want on the top here -->
  </RelativeLayout>
</FrameLayout>
Marloke
Thanks! Works well!
Robbe
Glad to help. Would you mind marking this answer as accepted? That would remove this from the unanswered questions list.
Marloke