Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No orientation specified, and the default is horizontal. This is a common source of bugs when children are added dynamically

Tags:

android

xml

My application can not be run since there is an error in my xml-file. One of my LinearLayouts are marked red and by hovering I can see the following error message: No orientation specified, and the default is horizontal. This is a common source of bugs when children are added dynamically.

You can see my code below and I will mark the line were I get this message as follows: <- error message ->

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal">

    <LinearLayout 
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:orientation="vertical"
        >
        <Button 
            android:id="@+id/btn1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Fragment 1"
            />

        <Button 
            android:id="@+id/btn2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Fragment 2"
            />

        <Button 
            android:id="@+id/btn3"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Fragment 3"
            />

    </LinearLayout>

    <LinearLayout             <- error message -> 
        android:id="@+id/myFragment"
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="3" />


</LinearLayout>
like image 733
Filip Eriksson Avatar asked Feb 28 '14 14:02

Filip Eriksson


1 Answers

You should add android:orientation="horizontal" in the LinearLayout block, same thing as you did above.

like image 106
fiipi Avatar answered Sep 23 '22 10:09

fiipi