我正在使用android中的自定義鍵盤實現。Android自定義鍵盤未找到行類異常
<android.inputmethodservice.Keyboard.Row>
<Key android:codes="113" android:keyLabel="q" android:keyEdgeFlags="left"/>
<Key android:codes="119" android:keyLabel="w"/>
<Key android:codes="101" android:keyLabel="e"/>
<Key android:codes="114" android:keyLabel="r"/>
<Key android:codes="116" android:keyLabel="t"/>
<Key android:codes="121" android:keyLabel="y"/>
<Key android:codes="117" android:keyLabel="u"/>
<Key android:codes="105" android:keyLabel="i"/>
<Key android:codes="111" android:keyLabel="o"/>
<Key android:codes="112" android:keyLabel="p" android:keyEdgeFlags="right"/>
</android.inputmethodservice.Keyboard.Row>
當我嘗試誇大這個佈局我獲得以下錯誤:
E/AndroidRuntime(4775): FATAL EXCEPTION: main
E/AndroidRuntime(4775): android.view.InflateException: Binary XML file line #9: Error inflating class android.inputmethodservice.Keyboard.Row
E/AndroidRuntime(4775): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
E/AndroidRuntime(4775): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
E/AndroidRuntime(4775): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
E/AndroidRuntime(4775): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime(4775): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime(4775): at com.mykeyboard.MyKeyboardService.onCreateInputView(MyKeyboardService.java:23)
E/AndroidRuntime(4775): at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:967)
E/AndroidRuntime(4775): at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1320)
E/AndroidRuntime(4775): at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1295)
E/AndroidRuntime(4775): at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:398)
E/AndroidRuntime(4775): at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:176)
E/AndroidRuntime(4775): at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
E/AndroidRuntime(4775): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(4775): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(4775): at android.app.ActivityThread.main(ActivityThread.java:3703)
E/AndroidRuntime(4775): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(4775): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(4775): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
E/AndroidRuntime(4775): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
E/AndroidRuntime(4775): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(4775): Caused by: java.lang.ClassNotFoundException: android.inputmethodservice.Keyboard.Row in loader dalvik.system.PathClassLoader[/data/app/com.mykeyboard-2.apk]
E/AndroidRuntime(4775): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
E/AndroidRuntime(4775): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
E/AndroidRuntime(4775): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime(4775): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
E/AndroidRuntime(4775): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
E/AndroidRuntime(4775): ... 19 more
外貌 到目前爲止,我已經在一個XML文件中聲明我的鍵盤佈局像它找不到android.inputmethodservice.Keyboard.Row in loader dalvik.system.PathClassLoader
但這是什麼意思?
有什麼建議嗎?
我從那個文件開始,但是這給出了以下錯誤。 http://pastebin.com/rkwaUcMe 對我來說看起來一樣,找不到課,但爲什麼不能? – Wouter
@Wouter:嘗試完整構建SoftKeyboard SDK示例。如果可行,請開始嘗試找出您的應用和該SDK示例有什麼不同。如果SDK示例不起作用,那麼我們有更大的問題...... :-) – CommonsWare