Reputation: 9545
Im trying to have two LinearLayout's next to each other but the below code wont work , it puts them so that one is on top.
can you please help. or do you have a better idea?
thanks?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="0.5"
android:background="#999">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="0.5"
android:background="#977000">
</LinearLayout>
</LinearLayout>
Upvotes: 1
Views: 2731
Reputation: 55
Set orientation of outer linear layout as "horizontal".. it works
Upvotes: 2
Reputation: 8645
use this just change android:orientation="horizontal"
in place of android:orientation="vertical
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#999"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#977000"
android:orientation="horizontal" >
</LinearLayout>
Upvotes: 4
Reputation: 3633
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
android:background="#999">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
android:background="#977000">
</LinearLayout>
</LinearLayout>
Upvotes: 1
Reputation: 17922
Replace android:orientation="vertical"
with android:orientation="horizontal"
in your top LinearLayout
.
Upvotes: 2
Reputation: 38098
This
android:orientation="vertical" >
has to be
android:orientation="horizontal" >
In your outer LinearLayout
Upvotes: 1
Reputation: 2150
Try to set your first linearLayout at "horizontal", not "vertical"
Upvotes: 1