S
S
SHAKIRA2014-04-03 01:42:29
Android
SHAKIRA, 2014-04-03 01:42:29

Android OS - how to make layouts not run into each other?

There are 3 LinearLayouts, one at the bottom, 2 on the sides above the third, but the problem is that they run into each other. If the right one is not forced to the right, then it climbs onto the left. Please tell me how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Kostritsyn, 2014-04-03
@sarfut

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    
    <LinearLayout android:id="@+id/bottom_layout"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:background="#ff0000"
        android:orientation="horizontal" />
    
    <LinearLayout android:id="@+id/left_layout"
        android:layout_width="120dp"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_above="@+id/bottom_layout"
        android:background="#00ff00"
        android:orientation="vertical" />
    
    <LinearLayout android:id="@+id/right_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/bottom_layout"
        android:layout_toRightOf="@+id/left_layout"
        android:background="#0000ff"
        android:orientation="vertical" />
</RelativeLayout>

Read also the official guide on RelativeLayout and positioning elements in it developer.android.com/intl/ru/guide/topics/ui/layo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question