My application cannot be started because there is an error in my XML file. One of my LinearLayouts is marked in red, and when I hover over the cursor, I see the following error message: The specified orientation is not specified, and the default is horizontal. This is a common source of errors when children are added dynamically.
You can see my code below, and I will mark the line, 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>
android xml
Filip eriksson
source share