Reputation: 203
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.
Upvotes: 2
Views: 1321
Reputation: 113
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?
Upvotes: 3
Reputation: 56925
Please remove android:stretchColumns="*"
From TableLayout.
Or Please provide any number instead of '*' like android:stretchColumns="2"
Upvotes: 6