I get an exception every time I launch the application. Here is the stacktrace for the exception
10-01 14:49:35.321: WARN/WindowManager(61): Exception when adding starting window
10-01 14:49:35.321: WARN/WindowManager(61): java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_height attribute.
10-01 14:49:35.321: WARN/WindowManager(61): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:438)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3468)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:3547)
10-01 14:49:35.321: WARN/WindowManager(61): at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1265)
10-01 14:49:35.321: WARN/WindowManager(61): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1191)
10-01 14:49:35.321: WARN/WindowManager(61): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2153)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2207)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1395)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:818)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.server.WindowManagerService$H.handleMessage(WindowManagerService.java:8794)
10-01 14:49:35.321: WARN/WindowManager(61): at android.os.Handler.dispatchMessage(Handler.java:99)
10-01 14:49:35.321: WARN/WindowManager(61): at android.os.Looper.loop(Looper.java:123)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.server.WindowManagerService$WMThread.run(WindowManagerService.java:531)
I am also posting the XML file I'm using.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/arw_layout" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:id="@+id/arw_logo" android:layout_width="30px"
android:layout_height="40px" android:layout_alignParentRight="true" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="center"
android:layout_alignParentLeft="true">
<TextView android:id="@+id/arw_left" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/arw_left"
android:textSize="25sp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:gravity="center_vertical" />
<TextView android:id="@+id/arw_title" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:minEms="10"
android:text="@string/arw_title" android:paddingLeft="10dp"
android:paddingRight="10dp" android:gravity="center" />
<TextView android:id="@+id/arw_right" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/arw_right"
android:textSize="25sp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:gravity="center_vertical" />
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#FF493538"
android:centerColor="#FF000000"
android:endColor="#FF000000"
android:angle="270" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
andro开发者_如何转开发id:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="Gallery1">
<attr name="android:galleryItemBackground" />
</declare-styleable>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="WindowTitleBackground" parent="android:WindowTitleBackground">
<item name="android:background">@drawable/gradient</item>
</style>
</resources>
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="titletheme">
<item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground
</item>
</style>
</resources>
I found the solution. I added the parent attribute parent="android:Theme" to my custom style, titletheme and it solved the problem.
Thanks for your replies
精彩评论