-1

尝试显示弹出面板时,我有这个日志(当然是我的活动崩溃:D)。我已经在他忙碌的 commonsware 高级编码器中看到了教程......只有当我添加弹出类时才会发生这种情况:关于我可以对第 2 行做什么的任何建议???问候日志:

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);
          }
        }
      }
4

1 回答 1

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]

类是LinearLayout(两个大写 L),而不是linearLayout

于 2012-02-17T13:54:21.030 回答