Teonee
Teonee

Reputation: 107

Clip Layout to Overlay

I have a little Problem with the app that I'm developing.

In the App I have a MapView with an overlay (a simple arrow which is drawn programatically) which is centerd on the screen.

Also I have a Layout which consists of two buttons and two textviews, basically forming a bar.

Now I want to clip the bar to the overlay so it stays centered with a little y-axis offset so it's basically over the bar with the same offset, regardless of screensize or resolution.

As requestet here is a layout sketch:

enter image description here

I appreciate any help or hint.

Thank you in advance!

Upvotes: 0

Views: 327

Answers (1)

Gene
Gene

Reputation: 46960

Put both the MapView and your bar layout inside a RelativeLayout. List the bar after the map to cause it to be rendered "on top." To form the offset above center, add a Space view somewhat larger than the overlay arrow centered on both dimensions. Align the bar vertically above the Space and centered horizontally. (In fact you could do the centered arrow as an ImageView or shape drawable view also in XML and use it rather than the space.)

Upvotes: 2

Related Questions