0

i have defined the following style:

<style name="Activity">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">fill_parent</item>
    <item name="android:background">@drawable/background</item>
    <item name="android:orientation">vertical</item>
</style>

But i want to define layout_height="wrap_content" in a layout, inheriting the rest of the attributtes:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Activity" 
android:layout_height="wrap_content">
...
</LinearLayout>

but it continues applying fill_parent height.

Is it possible? Any workaround?

joseantgv
  • 1,943
  • 1
  • 26
  • 34

2 Answers2

0

If you're changing the layout_height in your layout xml, then you might also have to set the layout_width.

Ifrit
  • 6,791
  • 8
  • 50
  • 79
0

Your new style

<style name="Activity">
<item name="android:layout_width">fill_parent</item>
<item name="android:background">@drawable/background</item>
<item name="android:orientation">vertical</item>

Fill_parent style

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android” style="@style/Activity"  android:layout_height="fill_parent”> </LinearLayout>

Wrap content style

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android” style="@style/Activity"  android:layout_height="wrap_content">

AAV
  • 3,785
  • 8
  • 32
  • 59
  • It doesn't solve my problem! The default property is android:layout_height="fill_parent” but i need to override it in one layout. If i take your solution i have to define it in all the layouts. I don't know if there isn't any solution and i have to do it this way. – joseantgv Jan 13 '12 at 08:11