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>
You should add android:orientation="horizontal"
in the LinearLayout
block, same thing as you did above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With