TableLayout Crashing application on android Lollipop

This question already has an answer here:

  • What is a NullPointerException, and how do I fix it? 12 answers

  • Since you said you removed all the java code then I would suggest something (wrote it in an answer so it fits). You have in your code a <View> inside a <TableLayout> which I suspect to be mistaken try to adjust your code to meet this (you have the same thing in more places change it all please):

    <TableLayout
                    android:id="@+id/orderDetails"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:stretchColumns="1"
                    android:background="@drawable/cell_shape"
                    android:layout_below="@id/terms"
                    android:layout_marginBottom="10dp">
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:layout_column="1"
                            android:text="Details"
                            android:layout_marginStart="15dp"
                            android:textStyle="bold"/>
                    </TableRow>
                    <View
                        android:layout_height="1dp"
                        android:background="@color/lightGray"/>
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:id="@+id/orderName"
                            android:layout_column="1"
                            android:padding="3dip"
                            android:layout_marginStart="15dp"/>
                        <TextView
                            android:id="@+id/quantity"
                            android:layout_column="2"
                            android:gravity="end"
                            android:padding="3dip"/>
                        <TextView
                            android:id="@+id/price"
                            android:layout_column="3"
                            android:gravity="end"
                            android:padding="3dip"
                            android:layout_marginEnd="15dp"/>
                    </TableRow>
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:layout_column="1"
                            android:padding="3dip"
                            android:text="Total Amount"
                            android:layout_marginStart="15dp"/>
                        <TextView
                            android:layout_column="3"
                            android:id="@+id/totalamount"
                            android:gravity="right"
                            android:padding="3dip"
                            android:layout_marginEnd="15dp"/>
                    </TableRow>
    
                </TableLayout>
                <TableLayout
                    android:id="@+id/orderAddress"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:stretchColumns="1"
                    android:background="@drawable/cell_shape"
                    android:layout_below="@id/orderDetails"
                    android:layout_marginBottom="10dp">
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:layout_column="1"
                            android:text="Pickup Address"
                            android:layout_marginStart="15dp"
                            android:textStyle="bold"/>
                    </TableRow>
                    <View
                        android:layout_height="1dp"
                        android:background="@color/lightGray"/>
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:id="@+id/address"
                            android:layout_column="1"
                            android:padding="3dip"
                            android:layout_marginStart="15dp"/>
                    </TableRow>
                </TableLayout>
                <TableLayout
                    android:id="@+id/noteForCheifa"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:stretchColumns="1"
                    android:background="@drawable/cell_shape"
                    android:layout_below="@id/orderAddress"
                    android:layout_marginBottom="10dp">
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:layout_column="1"
                            android:text="Note For Chef"
                            android:layout_marginStart="15dp"
                            android:textStyle="bold"/>
                    </TableRow>
                    <View
                        android:layout_height="1dp"
                        android:background="@color/lightGray"/>
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:id="@+id/ChefNote"
                            android:layout_column="1"
                            android:padding="3dip"
                            android:layout_marginStart="15dp"/>
                    </TableRow>
                </TableLayout>
    
    
    
                <TableLayout
                    android:id="@+id/paymentmode"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:stretchColumns="1"
                    android:background="@drawable/cell_shape"
                    android:layout_below="@id/noteForCheifa"
                    android:layout_marginBottom="90dp">
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <TextView
                            android:layout_column="1"
                            android:text="Select Payment Method"
                            android:layout_marginStart="15dp"
                            android:textStyle="bold"/>
                    </TableRow>
                    <View
                        android:layout_height="1dp"
                        android:background="@color/lightGray"/>
                    <TableRow
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">
                        <RadioGroup
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/RGroup">
                            <RadioButton
                                android:id="@+id/SelectTezUpi"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/Tez"
                                android:buttonTint="@color/colorPrimary"/>
                            <RadioButton
                                android:id="@+id/paytm"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="Paytm"
                                android:buttonTint="@color/colorPrimary"/>
                        </RadioGroup>
    
                    </TableRow>
                </TableLayout>
    

    在表格行内的textview中移除layout_width和layout_height或使layout_height =“wrap_content”

     <TableRow
                android:paddingTop="10dp"
                android:paddingBottom="10dp">
    
                <TextView
                    android:layout_column="1"
                    android:id="@+id/address"
                    android:layout_height="fill_parent"
                    android:layout_width="wrap_content"
                    android:layout_marginLeft="15dp"
                    android:layout_marginRight="15dp"/>
            </TableRow>
    
    链接地址: http://www.djcxy.com/p/84738.html

    上一篇: 填充有什么区别

    下一篇: TableLayout Android棒棒糖上的崩溃应用程序