In my android application i created and xml file in \res\layout\admin.xml
the layouts i used in it are :
<ScrollView >
<LinearLayout >
<TableLayout>
.
.
Components
.
.
</TableLayout>
<TableLayout>
.
.
Components
.
.
</TableLayout>
</LinearLayout>
</ScrollView>
error
!ENTRY com.android.ide.eclipse.adt 4 0 2011-11-17 13:35:10.046
!MESSAGE admin_view_pin.xml: / by zero
!STACK 0
java.lang.ArithmeticException: / by zero
at android.widget.TableLayout.mutateColumnsWidth(TableLayout.java:579)
at android.widget.TableLayout.shrinkAndStretchColumns(TableLayout.java:568)
at android.widget.TableLayout.measureVertical(TableLayout.java:466)
at android.widget.TableLayout.onMeasure(TableLayout.java:431)
at android.view.View.measure(View.java:10577)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4270)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:613)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
at android.view.View.measure(View.java:10577)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1090)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
at android.widget.ScrollView.onMeasure(ScrollView.java:314)
at android.view.View.measure(View.java:10577)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4270)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
at android.view.View.measure(View.java:10577)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4270)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:613)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
at android.view.View.measure(View.java:10577)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4270)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:613)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
at android.view.View.measure(View.java:10577)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:397)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:316)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:380)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1310)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1075)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:901)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.pageChange(LayoutEditor.java:403)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:290)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2743)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1429)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:257)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
Please guide me how can i remove this error and also i want to know why this error occured ??
admin_view_pin.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
style="@style/white_background_bl_aatharv">
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true">
<Button android:id="@+id/btnLogout" android:layout_gravity="right"
android:text="Logout" android:layout_width="wrap_content"
android:layout_height="wrap_content" style="@style/button_bl" />
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:stretchColumns="*">
<TableRow>
<TextView android:text="Select" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:gravity="center" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal">
<RadioGroup android:layout_width="fill_parent"
android:id="@+id/selectRadioGroup" android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton android:id="@+id/radio_datewise"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Date Wise" />
<RadioButton android:id="@+id/radio_IDwise"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="ID Wise" />
</RadioGroup>
</LinearLayout>
</TableRow>
<TableRow>
<TextView android:text="MemberID" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:gravity="center" />
<EditText android:id="@+id/txtMemberID"
android:layout_width="120dip" android:singleLine="true"
android:layout_height="wrap_content" android:enabled="false" />
</TableRow>
<TableRow>
<TextView android:text="From Date" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:gravity="center" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal">
<EditText android:id="@+id/startDate"
android:layout_width="120dip" android:singleLine="true"
android:layout_height="wrap_content" android:editable="false"
android:enabled="false" />
<Button android:layout_height="wrap_content" style="@style/button_bl"
android:layout_width="wrap_content" android:gravity="center"
android:id="@+id/btnStartDate" android:text="Set Date"
android:layout_gravity="center" android:enabled="false" />
</LinearLayout>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:text="To Date" android:layout_height="fill_parent"
android:gravity="center" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal">
<EditText android:id="@+id/endDate" android:layout_width="120dip"
android:singleLine="true" android:layout_height="wrap_content"
android:editable="false" android:enabled="false" />
<Button android:id="@+id/btnEndDate" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Set Date"
android:gravity="center" style="@style/button_bl"
android:layout_gravity="center" android:enabled="false" />
</LinearLayout>
</TableRow>
<TableRow>
<TextView android:text="Package Type"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:gravity="center" />
<Spinner android:id="@+id/spnPackageType"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<TextView android:text="Status" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:gravity="center" />
<Spinner android:id="@+id/spnStatus" android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<TextView android:text="Active Status"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:gravity="center" />
<Spinner android:id="@+id/spnActStatus"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
</TableRow>
<TableRow android:layout_gravity="center" android:gravity="center">
<Button android:id="@+id/btnGetDetails"
android:layout_width="wrap_content" android:gravity="center"
android:text="Get Details" android:layout_height="wrap_content"
style="@style/button_bl" />
</TableRow>
</TableLayout>
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:stretchColumns="*"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true" android:id="@+id/pinDetailsTable">
<TableRow>
<!-- <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> -->
</TableRow>
</TableLayout>
</LinearLayout>
</HorizontalScrollView>
</ScrollView>
When i remove HorizontalScrollView
from the layout i get this error
I think its your 2nd table layout, which doesn't have any columns in it, yet you're trying to stretch them all.
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:stretchColumns="*"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true" android:id="@+id/pinDetailsTable">
<TableRow>
<!-- <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> <TextView android:text="" android:padding="3dip" style="@style/text_subheader_wh"
/> -->
</TableRow>
</TableLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With