android – "…must supply a layout_height…" but its in my style resources?-ThrowExceptions

Exception or error:

I had a working app on 2.1 and above until I tried to cleanup my initial layout with a theme of styles. Now the app won’t even start with the “You must supply a layout_height attribute” failure message pointing to my first EditText View in the layout.

Why can I not move the ‘layout_height=30dp” that was working fine on every EditText into an
… item name=”android:layout_height”>30dp< … in a style referred to via my theme?

Virtually all my other style effects I abstracted out like this are working just fine.

[It won’t surprise me to learn this must be some styled override to the LinearLayout, not the EditText’s. OR that its got to be a styled item for the View, not the Widget. Dunno]

Ideas? Anyone? What is the obvious thing overlooked?
THANKS in advance for any suggestions!


<manifest xmlns:android=""
<application    android:label="xxx"
    android:icon="@drawable/xxx" >

<activity   android:name="DataEntry"
    android:theme="@style/xxx_theme.A" >


<style name="xxx_theme" parent="@android:Theme" >
  <item name="android:windowNoTitle">true</item>

<style name="xxx_theme.A" >
  <item name="android:textViewStyle">@style/xxx_TextView_widget</item>
  <item name="android:editTextStyle">@style/xxx_EditText_widget</item>
  <item name="android:checkboxStyle">@style/xxx_CheckBox_widget</item>
  <item name="android:radioButtonStyle">@style/xxx_Radio_widget</item>

<style name="xxx_EditText_widget" parent="@android:style/Widget.EditText" >
  <item name="android:textSize">9dp</item>
  <item name="android:layout_height">30dp</item>
  <item name="android:paddingLeft">8dp</item>
  <item name="android:paddingTop">1dp</item>
  <item name="android:paddingBottom">1dp</item>
  <item name="android:textColorHint">@color/texthint</item>
  <item name="android:singleLine">true</item>
  <item name="android:selectAllOnFocus">true</item>
  <item name="android:inputType">textNoSuggestions</item>
How to solve:

You have
<item name="android:layout_height">30dp</item>

but no android:layout_width in your style.

You need both.


Check out my answer here. It most likely has to do with a missing attribute in your styles.xml file.

Leave a Reply

Your email address will not be published. Required fields are marked *