views:

34

answers:

1

I'm starting to use RelativeLayout more and more but there are some things I keep running into.

Say I have a status textview that I want top and center. Then I have a bunch of other objects below it like images and a table layout.

I want the stuff below the status text view to respect the status textview's personal space and not draw themselves right on top of it.

But what I'm seeing is that in a relativelayout, everything piles up on eachother unless I use alignment such as android:layout_below and android:layout_above.

Is there an attribute that I can add to the status textview to make it so other objects don't want to draw right on top of it? Or do I have to keep using the alignment tags on everything and align things away from it?

Thanks!

+1  A: 

As described by the docs:

RelativeLayout is a Layout where the positions of the children can be described in relation to each other or to the parent

So you need to give an indication of how each UI element is to be positionned either with respect to one another or to the parent. Depending on your needs, you may be able to just use android:layout_alignWithParentIfMissing="true". Based on your description, I don't think you can do so.

See RelativeLayout Parameters. .

JRL