基本上我寫了一個自定義小部件,它將在屏幕上顯示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>
是的,我不敢相信我沒有看到!說實話,我有點寬慰,我認爲代碼是有序的! :) – Ian
@Ian:發生了 - 我自己也做了類似的事情。 :) – Squonk