2012-02-17 9 views
0

ポップアップパネルを表示しようとしているときに、このログを表示しています(もちろん、自分のアクティビティのクラッシュ:D)。私はコモンズウェアの忙しいアドバンスコーダーでチュートリアルを見てきました... ポップアップクラスを追加したときにだけ発生します: 2行目に何ができるのですか? 挨拶 ログ:MapView:android.view.InflateException:バイナリXMLファイルの行#2:inflatable class linearLayoutのエラー

java.lang.RuntimeException: Unable to start activity ComponentInfo{tfe.rma.ciss.be/tfe.rma.ciss.be.TheMap}: android.view.InflateException: 
    Binary XML file line #2: Error inflating class linearLayout 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 
      at android.app.ActivityThread.access$1500(ActivityThread.java:117) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 
      at android.os.Handler.dispatchMessage(Handler.java:99) 
      at android.os.Looper.loop(Looper.java:123) 
      at android.app.ActivityThread.main(ActivityThread.java:3687) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:507) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 
      at dalvik.system.NativeStart.main(Native Method) 
     Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class linearLayout 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:386) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
      at tfe.rma.ciss.be.TheMap$PopupPanel.<init>(TheMap.java:985) 
      at tfe.rma.ciss.be.TheMap$overlay4.<init>(TheMap.java:663) 
      at tfe.rma.ciss.be.TheMap.onCreate(TheMap.java:353) 
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 
      ... 11 more 
     Caused by: java.lang.ClassNotFoundException: android.view.linearLayout in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/tfe.rma.ciss.be-2.apk] 
      at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) 
      at java.lang.ClassLoader.loadClass(ClassLoader.java:551) 
      at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 
      at android.view.LayoutInflater.createView(LayoutInflater.java:471) 
      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549) 
      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66) 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568) 
      ... 18 more 

私のレイアウト:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 



    <com.google.android.maps.MapView 
     android:id="@+id/mapView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:enabled="true" 
     android:clickable="true" 
     android:apiKey="0lcrLCvFHx-8bK4lgE307_CyHXxgbjefMiI3w9w" 
     /> 
     <LinearLayout android:id="@+id/zoom" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     /> 

<SlidingDrawer 
     android:id="@+id/drawer" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:handle="@+id/handle" 
     android:content="@+id/content" 
     > 
     <ImageView 
      android:id="@id/handle" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/tray_handle_normal" 
     /> 

     <LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:id="@id/content" 
android:background="@layout/background" 
> 

    <TableLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:stretchColumns="1,2" 
    > 
    <TableRow> 
     <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingLeft="2dip" 
     android:paddingRight="4dip" 
     android:text="Emplacement : " 
     /> 
     <EditText android:id="@+id/getLat" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:cursorVisible="true" 
     android:editable="true" 
     android:singleLine="true" 
     android:layout_weight="1" 
     android:inputType="numberDecimal" 
     /> 
     <EditText android:id="@+id/getLon" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:cursorVisible="true" 
     android:editable="true" 
     android:singleLine="true" 
     android:layout_weight="1" 
     android:inputType="numberDecimal" 
     /> 
    </TableRow> 
    </TableLayout> 
    <Button android:id="@+id/goMap" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Afficher !" 
    /> 
    <LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="horizontal" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:id="@id/content" 
> 
<Button 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/sat" 
android:text="Satellite"> 
</Button> 

<Button 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/normal" 
android:text="normal"> 
</Button> 

<Button 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/traffic" 
android:text="traffic"> 
</Button> 
<Button 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/street" 
android:text="street"> 
</Button> 
</LinearLayout> 

</LinearLayout> 

    </SlidingDrawer> 

</RelativeLayout> 

ポップアップクラス:

class PopupPanel { 
     View popup; 
     boolean isVisible=false; 

     PopupPanel(int layout) { 
      ViewGroup parent=(ViewGroup)mapView.getParent(); 

      popup=getLayoutInflater().inflate(layout, parent, false); 

      popup.setOnClickListener(new View.OnClickListener() { 
      public void onClick(View v) { 
       hide(); 
      } 
      }); 
     } 

     View getView() { 
      return(popup); 
     } 

     void show(boolean alignTop) { 
      RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(
       RelativeLayout.LayoutParams.WRAP_CONTENT, 
       RelativeLayout.LayoutParams.WRAP_CONTENT 
     ); 

      if (alignTop) { 
      lp.addRule(RelativeLayout.ALIGN_PARENT_TOP); 
      lp.setMargins(0, 20, 0, 0); 
      } 
      else { 
      lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); 
      lp.setMargins(0, 0, 0, 60); 
      } 

      hide(); 

      ((ViewGroup)mapView.getParent()).addView(popup, lp); 
      isVisible=true; 
     } 

     void hide() { 
      if (isVisible) { 
      isVisible=false; 
      ((ViewGroup)popup.getParent()).removeView(popup); 
      } 
     } 
     } 

答えて

3

例外が

Caused by: java.lang.ClassNotFoundException: android.view.linearLayout in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/tfe.rma.ciss.be-2.apk] 

クラスはですがあります(2つの大文字のL)ではなく、linearLayoutです。

+0

LinearLayout?私のレイアウトではすべてがうまくいくようです。 – youssoua

+0

@youssoua: 'PopupPanel'はレイアウトを膨張させています。そのレイアウトは上に示したレイアウトではなく、 'MapView'を含んでいます。また、パネルを表示するときにクラッシュが発生すると言います。おそらく、欠陥のあるXMLを持つものは、 'PopupPanel'で使用しているレイアウトです。 – CommonsWare

+0

私は最終的に正しいレイアウト、thxを見つけました:-) – youssoua

関連する問題