Android 为弹出窗口充气时未捕获的处理程序

Android 为弹出窗口充气时未捕获的处理程序,android,view,popup,layout-inflater,Android,View,Popup,Layout Inflater,我正在尝试使用弹出窗口显示发票的详细信息。我在网上看了一些例子,它们都是这样的,所以我不明白为什么当我试图夸大观点时会出错。我注意到的唯一一件事是,在项目布局文件夹中的invoice_look后面有一个单词port。 我在这行中得到了这个错误: View popupView = layoutInflater.inflate(R.layout.invoice_look,null); this = {com.android.internal.os.RuntimeInit$UncaughtH

我正在尝试使用弹出窗口显示发票的详细信息。我在网上看了一些例子,它们都是这样的,所以我不明白为什么当我试图夸大观点时会出错。我注意到的唯一一件事是,在项目布局文件夹中的invoice_look后面有一个单词port。 我在这行中得到了这个错误:

View popupView = layoutInflater.inflate(R.layout.invoice_look,null);

    this = {com.android.internal.os.RuntimeInit$UncaughtHandler@21167} 
    shadow$_klass_ = {java.lang.Class@20712} "class  com.android.internal.os.RuntimeInit$UncaughtHandler"
    accessFlags = 524288
    classLoader = null
    classSize = 416
    clinitThreadId = 14084
  componentType = null
  dexCache = {java.lang.DexCache@21169} 
  dexCacheStrings = {java.lang.String[105519]@21170} 
  dexClassDefIndex = 3975
  dexTypeIndex = 4549
  directMethods = {java.lang.reflect.ArtMethod[2]@21171} 
  iFields = null
  ifTable = {java.lang.Object[2]@21172} 
  name = {java.lang.String@21173} "com.android.internal.os.RuntimeInit$UncaughtHandler"
  numReferenceInstanceFields = 0
  numReferenceStaticFields = 0
  objectSize = 8
  primitiveType = 0
  referenceInstanceOffsets = -2147483648
  referenceStaticOffsets = 0
  sFields = null
  status = 10
  superClass = {java.lang.Class@20126} "class java.lang.Object"
  verifyErrorClass = null
  virtualMethods = {java.lang.reflect.ArtMethod[1]@21174} 
  vtable = null
  shadow$_klass_ = {java.lang.Class@18444} "class java.lang.Class"
  shadow$_monitor_ = -1493239949
 shadow$_monitor_ = -1272289465
以下是我活动中的代码

lookBtn.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            LayoutInflater layoutInflater = (LayoutInflater) Pickup.this.getSystemService(LAYOUT_INFLATER_SERVICE);
            View popupView = layoutInflater.inflate(R.layout.invoice_look,null);
            final PopupWindow popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

            Button dismissBtn = (Button) popupView.findViewById(R.id.lookDismiss);
            dismissBtn.setOnClickListener(new Button.OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    popupWindow.dismiss();
                }
            });

            popupWindow.showAtLocation(v, Gravity.CENTER, 0, 0);

        }
    });
下面是invoice_look窗口的XML

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/invLookLayout">

          <ListView
            android:id="@+id/listView"
            android:layout_width="500dp"
            android:layout_height="520dp" />

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TableRow
                android:id="@+id/tableRow"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/textView25"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start"
                    android:text="@string/discount" />

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/textView26"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start" />

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/lookDiscount"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="end" />
            </TableRow>

            <TableRow
                android:id="@+id/tableRow5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/textView28"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start"
                    android:text="@string/env" />

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/textView29"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start" />

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/lookEnviro"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="end" />
            </TableRow>

            <TableRow
                android:id="@+id/tableRow6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/textView31"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start"
                    android:text="@string/salestax" />

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/textView32"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start" />

                <TextView
                    style="@style/BlackSText"
                    android:id="@+id/lookSalesTax"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="end" />
            </TableRow>

            <TableRow
                android:id="@+id/tableRow7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    style="@style/BlackText"
                    android:id="@+id/textView34"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start"
                    android:text="@string/total" />

                <TextView
                    style="@style/BlackText"
                    android:id="@+id/lookPcs"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="start"
                    android:text="@string/pcs" />

                <TextView
                    style="@style/BlackText"
                    android:id="@+id/lookTotal"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="end" />
            </TableRow>
        </TableLayout>

        <TextView
            style="@style/BlackText"
            android:id="@+id/textView24"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="20sp" />

        <GridLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:columnCount="5"
            android:columnOrderPreserved="true"
            android:rowCount="1"
            android:rowOrderPreserved="false"
            android:useDefaultMargins="false"
            android:orientation="horizontal"
            android:id="@+id/gridLayout"
            android:focusableInTouchMode="false" >

            <Button
                style="@style/BlackSText"
                android:id="@+id/lookDismiss"
                android:layout_width="96dp"
                android:layout_height="70dp"
                android:layout_column="0"
                android:layout_row="0"
                android:background="@drawable/lightrebbtn"
                android:text="@string/cancel"
                android:layout_gravity="fill_horizontal" />

            <Button
                style="@style/BlackSText"
                android:id="@+id/button58"
                android:layout_width="96dp"
                android:layout_height="70dp"
                android:layout_column="1"
                android:layout_row="0"
                android:background="@drawable/yellowbtn"
                android:text="@string/del"
                android:layout_gravity="fill_horizontal" />

            <Button
                style="@style/BlackSText"
                android:id="@+id/button61"
                android:layout_width="96dp"
                android:layout_height="70dp"
                android:layout_column="2"
                android:layout_row="0"
                android:background="@drawable/yellowbtn"
                android:text="@string/price"
                android:layout_gravity="fill_horizontal" />

            <Button
                style="@style/BlackSText"
                android:id="@+id/button62"
                android:layout_width="96dp"
                android:layout_height="70dp"
                android:layout_column="3"
                android:layout_row="0"
                android:background="@drawable/yellowbtn"
                android:text="@string/myo"
                android:layout_gravity="fill_horizontal" />

            <Button
                style="@style/BlackSText"
                android:id="@+id/button63"
                android:layout_width="96dp"
                android:layout_height="70dp"
                android:layout_column="4"
                android:layout_row="0"
                android:background="@drawable/yellowbtn"
                android:text="@string/coupon"
                android:layout_gravity="fill_horizontal" />
        </GridLayout>
</LinearLayout>

您可以发布布局文件夹屏幕或尝试使用port word发布布局名称吗?我发现它只是将其放在port文件夹中,因为我在创建布局时选择了“纵向”,如果我选择了“横向”,则布局后会显示“land”。您能在我的邮件中共享您的代码吗?谢谢您的帮助。我复制了所有的布局文本,然后创建了一个新的布局,没有选择方向。然后将其粘贴到新布局中。新的布局很好,没有错误。