@Override
protected void onPostExecute(Void result)
{
/*TableLayout tl= (TableLayout) rootView1.findViewById(R.id.tablelayout);
TableRow tr=new TableRow(this.mContext);
TextView tv=new TextView(this.mContext);
tv.setText(Integer.toString(colSize));
tr.addView(tv);
tl.addView(tr);*/
TableLayout tl= (TableLayout) rootView1.findViewById(R.id.tablelayout);
//TableRow[] tr=new TableRow[colSize%5];
//TextView[] tv=new TextView[colSize];
System.out.print(colSize);
int limit=1;
if(Integer.parseInt(desc1)==0)
{
for(int i=0;i<5;i++)
{
TableRow tr = new TableRow(mContext);
tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
while(limit<=colSize)
{
if(limit==colSize)
{
break;
}
else
if(limit%5==0)
{
limit++;
break;
}
TextView tv=(TextView) new TextView(mContext);
tv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
tv.setText(colVals[i]);
tr.addView(tv);
limit++;
}
tl.addView(tr,i);
}
}
}
错误记录
01-13 06:41:10.767: E/AndroidRuntime(871): FATAL EXCEPTION: main
01-13 06:41:10.767: E/AndroidRuntime(871): java.lang.ArithmeticException: divide by zero
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.TableLayout.mutateColumnsWidth(TableLayout.java:587)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.TableLayout.shrinkAndStretchColumns(TableLayout.java:576)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.TableLayout.measureVertical(TableLayout.java:474)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.TableLayout.onMeasure(TableLayout.java:439)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.View.measure(View.java:15518)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:681)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.View.measure(View.java:15518)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.View.measure(View.java:15518)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1451)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.View.measure(View.java:15518)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.View.measure(View.java:15518)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.View.measure(View.java:15518)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
01-13 06:41:10.767: E/AndroidRuntime(871): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.View.measure(View.java:15518)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.Choreographer.doFrame(Choreographer.java:532)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.os.Handler.handleCallback(Handler.java:725)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.os.Handler.dispatchMessage(Handler.java:92)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.os.Looper.loop(Looper.java:137)
01-13 06:41:10.767: E/AndroidRuntime(871): at android.app.ActivityThread.main(ActivityThread.java:5041)
01-13 06:41:10.767: E/AndroidRuntime(871): at java.lang.reflect.Method.invokeNative(Native Method)
01-13 06:41:10.767: E/AndroidRuntime(871): at java.lang.reflect.Method.invoke(Method.java:511)
01-13 06:41:10.767: E/AndroidRuntime(871): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-13 06:41:10.767: E/AndroidRuntime(871): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-13 06:41:10.767: E/AndroidRuntime(871): at dalvik.system.NativeStart.main(Native Method)
布局参数有什么问题?救命? 分频器就是问题所在。 还想知道我是否可以为表的所有行提供textview和tablerow名称的相同id名称?它是一个用于抓取表标签并在android中动态生成的表中显示表数据的jsoup程序。