0

I am trying to display a table layout.In that i have the following error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.budget1/com.budget1.Report}: android.view.InflateException: Binary XML file line #2: Error inflating class Tablelayout

My xml code is:

<?xml version="1.0" encoding="utf-8"?>
<Tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent">
    <Tablerow>
 <Textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enter your name">
     </Textview>
    <Edittext android:layout_width="150px" android:layout_height="wrap_content">
        </Edittext>
    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Submit"
    />
    </Tablerow>

 <Tablerow>
 <Textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Spanning Two columns" android:layout_span="2">
     </Textview>
    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Cancel"
    />
 </Tablerow>

</Tablelayout>

Please help me..

prakash .k
  • 635
  • 2
  • 12
  • 24

3 Answers3

2

Android layout xml files are case sensitive. Use TableLayout, TableRow, TextView, EditText, etc.

Tamás Szincsák
  • 1,031
  • 2
  • 12
  • 31
0

You did not specify Ids for your layout components. Try adding a unique ID for each TableRow, TextView, ...etc using parameter android:id="@+id/your_desired_id"

Mohamed_AbdAllah
  • 5,311
  • 3
  • 28
  • 47
0

I Edited your xml file like this, its working fine,

   <TableLayout

    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

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

        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Enter your name"
                />


        <EditText
                  android:layout_width="150px"
                  android:layout_height="wrap_content"
                />


        <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Submit"
                />
     </TableRow>

    <TableRow

        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
                android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Spanning Two columns"
                  android:layout_span="2" />

        <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Cancel"
                />
    </TableRow>

  </TableLayout>
Vishwanath.M
  • 6,235
  • 11
  • 42
  • 56