R3D3vil
R3D3vil

Reputation: 681

Error in displaying nested LinearLayout

I am using nested linearlayout in my xml file.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
>

<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:text="left"
   android:layout_weight="1"
   android:layout_gravity="left"
   android:id="@+id/previous"></Button>
   <TextView  
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_weight="1"
android:gravity="center"
android:id="@+id/date"
android:textColor="#505050"
/>  
<Button android:text="right"
android:layout_weight="1"
android:layout_gravity="right"
   android:id="@+id/next"></Button>
</LinearLayout>
.........
........
</LinearLayout>  

My application doesnt start , i get an error message saying the process stopped unexpectedly. Though it works without the inner Linearlayout. Any ideas why?

Thanks

Upvotes: 1

Views: 198

Answers (1)

kabuko
kabuko

Reputation: 36302

You should definitely post the stack trace when you have exceptions thrown and you want help, but in this case you seem to be missing the layout_width and layout_height attributes for your buttons.

Upvotes: 1

Related Questions