Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ADT plugin error: main.xml: / by zero

I'm new to this site so please excuse my formatting issues. My problem is that I get this error in eclipse when I try to add a row to my xml TableLayout in the graphical layout tab of my xml document. My error is the following

Exception raised during rendering: / by zero
Exception details are logged in Window > Show View > Error Log

Here is my XML code. For some reason, even though a row is automatically added to the main.xml file, the graphical layout displays an error.

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/tableLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:padding="5dp"
    android:stretchColumns="*" >

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

</TableLayout>

Let me know if you have any ideas about what I'm doing wrong, or if you need more info.

like image 721
Vizzle Avatar asked Sep 23 '26 16:09

Vizzle


2 Answers

Please remove android:stretchColumns="*" From TableLayout.

Or Please provide any number instead of '*' like android:stretchColumns="2"

like image 71
Chirag Avatar answered Sep 25 '26 04:09

Chirag


I've stumbled into the same problem and I guess that we're both following the book "Android for Programmers" by Deitel (in particular, this issue originates in p.127). I've decided to drop it and look somewhere else. The book explicitly says to set android:stretchColumns to "*" and a couple of paragraphs later they ask you to add rows to a TableLayout. Have they tested it?

like image 28
JPeraita Avatar answered Sep 25 '26 04:09

JPeraita



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!