-1

**我是一名新的 android 开发人员。我使用 android 屏幕布局...lauout 设计是**

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/row1"
android:orientation="horizontal" >

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".1" >
</TableRow>

<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".5"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".2" >
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/man" />
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".2" >
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/man" />
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".2" >
</TableRow>
</LinearLayout>

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".1" >
</TableRow>

<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="3"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="BRUCE LEE $ MAO ZEDONG"
android:textColor="#000"
android:textSize="12sp"
android:textStyle="bold" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="25dp"
android:src="@drawable/clock" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="30 minute ago "
android:textColor="#000"
android:textSize="10sp"
android:textStyle="bold" />
</TableRow>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="3"
android:background="@drawable/backimage"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".5" >
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="4" >

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".2" >
</TableRow>

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1" >

<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/defaultbi" />
</TableRow>

<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="3"
android:orientation="vertical" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LOREM IPSUM DOLOR SPECIAL OFFER 30%"
android:textColor="#000"
android:textSize="8sp"
android:textStyle="bold" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="prosato vai is a software enginure jhjdshjhjkfhjkfjksdjjdjjjkjiddsdj"
android:textColor="#fff"
android:textSize="8sp"
android:textStyle="bold" />
</LinearLayout>

<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".4"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".5" >
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="2" >

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/arrow" />
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".5" >
</TableRow>
</LinearLayout>
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".8" >
</TableRow>
</LinearLayout>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/pin" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="245 milles 22mb Baker Street London"
android:textColor="#000"
android:textSize="8sp"
android:textStyle="bold" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cro" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="at Scroll Bar"
android:textColor="#000"
android:textSize="8sp"
android:textStyle="bold" />
</TableRow>
</LinearLayout>

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".1" >
</TableRow>
</LinearLayout>

<TableRow
android:layout_width="fill_parent"
android:layout_height="1dp" >

<View
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#a3a3a3" />
</TableRow>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/row1"
android:orientation="horizontal" >

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".1" >
</TableRow>

<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".8"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".8" >
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.2" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/man" />
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".8" >
</TableRow>
</LinearLayout>

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight=".1" >
</TableRow>

<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="4"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="JACKIE CHAN"
android:textColor="#000"
android:textSize="12sp"
android:textStyle="bold" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="45dp"
android:src="@drawable/photo" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:text="photo "
android:textColor="#000"
android:textSize="10sp"
android:textStyle="bold" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/clock" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:text="40 minute ago"
android:textColor="#000"
android:textSize="10sp"
android:textStyle="bold" />
</TableRow>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="3"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="4" >

<TableRow
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="2.5" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="fghghjdjdjfhdjfhjhjjjn  jhjhdfjds hjhdfjdnf " />
</TableRow>

<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical" >

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
</TableRow>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/threetwo"
    android:text="Agree"
    android:textColor="#ffffff"
    android:textSize="14sp"
    android:textStyle="bold" />
</TableRow>


</LinearLayout>
</TableRow>
</LinearLayout>

<TableRow
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/pin" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="245 milles 22mb Baker Street London"
android:textColor="#000"
android:textSize="8sp"
android:textStyle="bold" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cro" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="at Scroll Bar"
android:textColor="#000"
android:textSize="8sp"
android:textStyle="bold" />
</TableRow>
</LinearLayout>

<TableRow
android:layout_width="0dip"`enter code here`
android:layout_height="fill_parent"
android:layout_weight=".2" >
</TableRow>
</LinearLayout>

</LinearLayout>

但是当我运行我的应用程序时,它会显示 StackOverflowError.那些错误显示到 logcat .....

    FATAL EXCEPTION: main
    java.lang.StackOverflowError
at android.view.View.draw(View.java:6739)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)`enter code here`
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.ja`enter code here`va:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:1365)
at android.widget.ListView.dispatchDraw(ListView.java:3046)
at android.view.View.draw(View.java:6845)
at android.widget.AbsListView.draw(AbsListView.java:2257)
at android.view.View.buildDrawingCache(View.java:6501)
at android.view.View.getDrawingCache(View.java:6287)
at android.view.ViewGroup.drawChild(ViewGroup.java:1573)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.support.v4.view.ViewPager.draw(ViewPager.java:1923)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at    com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
at android.view.View`enter code here`Root.draw(ViewRoot.java:1422)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)

现在,我该如何解决这个错误,请帮帮我..(我使用 htc 2.2 os 设备)

4

2 回答 2

1

首先,你必须重新定义你的布局。您正在不当使用TableRow. ATableRow应始终用作 a 的子级TableLayout

我建议您阅读有关在 Android 中设计正确布局的文档。很少有用途TableLayout/TableRow(但很多人在网页设计中滥用它们,增加了很多不受欢迎的额外处理)。通常使用一个主要RelativeLayout的几个内部LinearLayoutRelativeLayout实例(尽量不要嵌套很多),您可以实现大多数布局。

于 2013-02-05T13:39:14.507 回答
0

堆栈溢出错误

当正在运行的程序的堆栈深度超过某些平台或 VM 特定限制时抛出。通常,这只会在程序变得无限递归时发生,但它也可能发生在正确编写(但深度递归)的程序中。

于 2013-02-05T13:37:47.350 回答