获得错误膨胀相对布局

时间:2011-09-06 13:37:44

标签: android layout view map

基本上我已经编写了一个自定义小部件,它将在屏幕上显示5次,一个在另一个之下,右侧有一个地图视图。我有自定义小部件工作,但当我尝试显示地图时,我收到了一些错误(见下文)

我不确定我在哪里出错:S

09-06 14:27:49.085: ERROR/AndroidRuntime(28198): FATAL EXCEPTION: main
09-06 14:27:49.085: ERROR/AndroidRuntime(28198): java.lang.RuntimeException: Unable to start activity ComponentInfo{Hartford.gps/Hartford.gps.MapCalculations}: android.view.InflateException: Binary XML file line #2: Error inflating class RelitiveLayout
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.os.Looper.loop(Looper.java:123)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.ActivityThread.main(ActivityThread.java:3691)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at java.lang.reflect.Method.invokeNative(Native Method)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at java.lang.reflect.Method.invoke(Method.java:507)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at dalvik.system.NativeStart.main(Native Method)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class RelitiveLayout
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.Activity.setContentView(Activity.java:1657)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at Hartford.gps.MapCalculations.onCreate(MapCalculations.java:18)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     ... 11 more
09-06 14:27:49.085: ERROR/AndroidRuntime(28198): Caused by: java.lang.ClassNotFoundException: android.view.RelitiveLayout in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/Hartford.gps-2.apk]
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.view.LayoutInflater.createView(LayoutInflater.java:471)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
09-06 14:27:49.085: ERROR/AndroidRuntime(28198):     ... 19 more

这是XML文件

<?xml version="1.0" encoding="utf-8"?>
<RelitiveLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Hartford.gps.GaugeView
    android:id="@+id/gauge"
    android:layout_width="160px"
    android:layout_height="100px" 
    android:background="#ffffff"
    android:antialias="true"
    />
<Hartford.gps.GaugeView
    android:id="@+id/gauge2"
    android:layout_width="160px"
    android:layout_height="100px" 
    android:background="#ffffff"
    android:antialias="true"
    />
<Hartford.gps.GaugeView
    android:id="@+id/gauge3"
    android:layout_width="160px"
    android:layout_height="100px" 
    android:background="#ffffff"
    android:antialias="true"
    />
<Hartford.gps.GaugeView
    android:id="@+id/gauge4"
    android:layout_width="160px"
    android:layout_height="100px" 
    android:background="#ffffff"
    android:antialias="true"
    />
<Hartford.gps.GaugeView
    android:id="@+id/gauge5"
    android:layout_width="160px"
    android:layout_height="100px" 
    android:background="#ffffff"
    android:antialias="true"
    />
<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="false"
    android:apiKey="0xO7eqfjJxqq5P_yfuU0_Wdi7Q4xPfRi95B_AYw"
    />
</RelitiveLayout>

2 个答案:

答案 0 :(得分:6)

<RelitiveLayout xmlns:android="http://schemas.android.com/apk/res/android"

它应该是“RelativeLayout”而不是“RelitiveLayout”

答案 1 :(得分:3)

看起来你有拼写错误'RelitiveLayout'。 我想在这堂课上Hartford.gps.MapCalculations.onCreate(MapCalculations.java:18)

可能想搜索整个项目,以便在eclipse中使用ctrl + H找出错误的位置。