Error "Add height attribute"

I am trying to resolve the Android error "You must specify the layout_height attribute". In the DDMS error message:

10-06 12:45:12.431: WARN/WindowManager(62): HistoryRecord{406287f8 com.learning.android.yamba/.TimelineActivity} failed creating starting window 10-06 12:45:12.431: WARN/WindowManager(62): java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_height attribute. 10-06 12:45:12.431: WARN/WindowManager(62): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491) 10-06 12:45:12.431: WARN/WindowManager(62): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3599) 10-06 12:45:12.431: WARN/WindowManager(62): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:3678) 

My TimelineActivity XML file is as follows:

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" style="@style/activity"> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/title" android:text="@string/titleTimeline" android:layout_gravity="center"> </TextView> <ListView style="@style/editbox" android:id="@+id/listStatuses" android:cacheColorHint="#00000000"> </ListView> </LinearLayout> 

Related styles are as follows:

 <style name="activity"> <item name="android:orientation">vertical</item> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">fill_parent</item> <item name="android:background">@drawable/background</item> </style> <style name="title"> <item name="android:textSize">25dp</item> <item name="android:gravity">center</item> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">wrap_content</item> </style> <style name="editbox"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">fill_parent</item> <item name="android:layout_weight">1</item> <item name="android:background">#609f</item> <item name="android:padding">10dp</item> <item name="android:layout_margin">15dp</item> <item name="android:textSize">15dp</item> </style> 

The background of the window does not appear in the list window, although I set the transparency of the background of the list. Not sure if the two are related.

+4
source share
2 answers

See here for a solution:

fooobar.com/questions/1375307 / ...

The problem is probably due to the fact that you used a custom theme in the AndroidManifest.xml file. This has nothing to do with your location.

+1
source

I know this is a few months, but I think I have an answer for you.

You create an xml style size value:

 <dimen name="layoutheight_title">wrap_content</dimen> <dimen name="layoutwidth_title">fill_parent</dimen> 

Then you specify the dimension value in your xml layouts as needed.

 android:layout_height="@dimen/layoutheight_title" android:layout_width="@dimen/layoutwidth_title" 
0
source

All Articles