2013-07-08 5 views
0

J'ai utilisé la bibliothèque SlidingMenu dans mon application, selon https://github.com/xamarin/monodroid-samples/tree/master/SlidingMenu. Je construis et exécute l'application avec succès sur l'android 4.0+, mais j'ai échoué exécuter l'application sur l'android 2.2, mais j'ai vu le menu coulissant android https://github.com/jfeinstein10/SlidingMenu, il prend en charge à partir de android 2.1.Monodroid Sliding Menu ne peut pas fonctionner à android 2.2

Ce code d'erreur est:

at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) <0x00088> 
at Com.Slidingmenu.Lib.App.SlidingActivity.SetBehindContentView (int) <0x00237> 
at regrecall.HomeActivity.OnCreate (Android.OS.Bundle) <0x00097> 
at Com.Slidingmenu.Lib.App.SlidingActivity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005f> 
at (wrapper dynamic-method) object.ffcb4990-4b21-40ac-9622-acbf3c40174b (intptr,intptr,intptr) <0x00043> 

    --- End of managed exception stack trace --- 
android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.ListView 
    at android.view.LayoutInflater.createView(LayoutInflater.java:513) 
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 
    at com.slidingmenu.lib.app.SlidingActivity.setBehindContentView(SlidingActivity.java:83) 
    at regrecall.HomeActivity.n_onCreate(Native Method) 
    at regrecall.HomeActivity.onCreate(HomeActivity.java:32) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 
    at android.app.ActivityThread.access$2300(ActivityThread.java:125) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 
    at android.os.Handler.dispatchMessage(Handler.java:99) 
    at android.os.Looper.loop(Looper.java:123) 
    at android.app.ActivityThread.main(ActivityThread.java:4627) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:521) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
    at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException 
    at android.widget.ListView.<init>(ListView.java:153) 
    at java.lang.reflect.Constructor.constructNative(Native Method) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:500) 
    ... 22 more 
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/common_background.png from drawable resource ID #0x7f020081: .xml extension required 
at android.content.res.Resources.loadColorStateList(Resources.java:1824) 
    at android.content.res.TypedArray.getColor(TypedArray.java:319) 
    at android.widget.AbsListView.<init>(AbsListView.java:554) 
    at android.widget.ListView.<init>(ListView.java:157) 
    ... 26 more 

Oubliez-moi que je ne peux pas copier tout le journal, car les journaux sur l'autre machine ne peut pas se connecter au réseau. J'analyse ce journal, il s'est écrasé à la méthode SldingMenuActivity onCreate, il a échoué à créer la liste pour la vue derrière sur l'activité, mais il peut fonctionner sur Android 4.0+, c'est trop étrange.

Le problème que je trouve: mon listview ne peut pas infalte sur Android 2.2, même ma mise en page est si simple ci-dessous

<?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" 
    > 
    <ListView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/Home_MenuList" 
     /> 
</LinearLayout> 
+0

Il y a probablement beaucoup plus de traces dans cette pile, alors postez la trace complète ici. – Cheesebaron

+0

sûr, Le journal est soufflé: android.view.InflateException: Ligne de fichier XML binaire # 1: Erreur gonflage de classe android.widget.ListView à android.view.LayoutInflater.createView (LayoutInflater.java:513) à com. android.internal.policy.impl.PhoneLayoutInflater.onCreateView (PhoneLayoutInflater.java:56) à android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:563) à android.view.LayoutInflater.rInflate (LayoutInflater.java:618) à android.view.LayoutInflater.inflate (LayoutInflater.java:407) à android.view.LayoutInflater.inflate (LayoutInflater.java:320) – regrecall

+0

à android.view.LayoutInflater.inflate (LayoutInflater.java:276) à com.slidingmenu.lib.app.SlidingActivity.setBehindContentView (SlidingActivity.java:83) à regrecall.HomeActivity.n_onCreate (méthode native) à regrecall.HomeActivity.onCreate (HomeActivity.java:32) 22 [MonoDroid] at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java: 1047) à android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2627) à android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2679) à android.app.ActivityThread.access $ 2300 (ActivityThread.java:125 – regrecall

Répondre

0

Si vous jetez un oeil à la section Caused by dans votre trace de la pile, il vous dit:

Causée par: android.content.res.Resources $ NotFoundException: res fichier/drawable/common_background.png de ressources drawable ID # 0x7f020081: l'extension .xml nécessaire

Il y a quelque chose de mal à cette ressource, sont tout du ListViewItem s utilisant cette ressource Drawable?

+0

Cette image utilisée pour android: windowBackground, android: colorBackground, L'étrange est le code fonctionne avec succès sur Android 4.0+, mais il a échoué fonctionne sur Android 2.2. – regrecall

Questions connexes