fred jones
fred jones

Reputation: 255

I want to have a RelativeLayout and LinearLayout in the same layout

https://i.sstatic.net/Utrxn.png

I made a picture showing what I want my layout to look like. Basically it's a RelativeLayout on top of a LinearLayout. I set the layout_weight=3 for relative, and layout_weight=1 for linear. This is not working so far. Can anyone tell me whats wrong with my XML?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="kim.albert.marveleventtracker.EventDescriptionActivity">

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="3"></RelativeLayout>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:orientation="horizontal">
</RelativeLayout>

Upvotes: 0

Views: 91

Answers (1)

Hnib
Hnib

Reputation: 133

You should change top layout is LinearLayout, set orientation is vertical

Upvotes: 2

Related Questions