Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LinearLayout does not set the required layout_height attribute

I'm making a layout and applying some styles. so:

<style name="LayoutSmallMap">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">180dip</item>
        <item name="android:background">@drawable/rounded_corner</item>
        <item name="android:layout_margin">5dip</item>
        <item name="android:padding">3dip</item>
</style>

And I use this:

<LinearLayout 
       style="@style/LayoutSmallMap">

</LinearLayout>

But when I test the phone before it gives error and now states:

LinearLayout does not set the required layout_height attribute

He is not finding the attribute in my style?

Do not know if it's the best solution, but it worked for me: Target SDK: 2.3 and minSdkVersion="7"

like image 405
Aderbal Nunes Avatar asked Nov 13 '22 04:11

Aderbal Nunes


1 Answers

You should not use android:layout_width and android:layout_height in styles. Modify your code as follows.

<style name="LayoutSmallMap">
        <item name="android:background">@drawable/rounded_corner</item>
        <item name="android:layout_margin">5dip</item>
        <item name="android:padding">3dip</item>
</style>


<LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="180dip"  
       style="@style/LayoutSmallMap">

</LinearLayout>
like image 191
Vipul Avatar answered Nov 16 '22 02:11

Vipul