Martin
Martin

Reputation: 7310

How to setup this layout in android?

In Android I'm trying to get a layout looking like this image using xml.

enter image description here

What I've been trying to do is to separate the view vertical into two parts. One for the blue part and one for the white. For the blue part I use a shape as background to get the gradient and for the white part just a white background. It works good for the "Title" and "Some text" part. But as the image view should overlay both layouts it isn't working.

I can't figure out how to setup the xml layout to get it working, any ideas?

Upvotes: 0

Views: 273

Answers (2)

Vincent Mimoun-Prat
Vincent Mimoun-Prat

Reputation: 28561

I would do it like this:

<RelativeLayout>
    <TextView 
        android:id="@+id/title"
        android:layout_alignParentTop="true"
        android:text="title"
        />
    <TextView 
        android:layout_below="@id/title"
        android:layout_alignParentBottom="true"
        android:text="some text here"
        />
    <ImageView 
        android:layout_alignParentLeft="true"
        android:text="title"
        />
</RelativeLayout>

Of course, you'll need to set the layout width, height, ... on those elements.

Upvotes: 1

Brian Driscoll
Brian Driscoll

Reputation: 19635

I think that you'll find the answer here: set the absolute position of a view in Android

Upvotes: 0

Related Questions