English 中文(简体)
Android场坠毁: 4. 普通XML文件第10条必须提供假肢。
原标题:Android layout crash: Binary XML file line #10 must supply a layout width

我 st忙,我已经把它推到较大的布局(<>>edit)这一合并部分。 感谢的是,第10行是显而易见的,关于第10行的案文概览显然需要宽度和高度,但是,没有使用在《法典》中进一步存在的公正文本来进行坠毁,我已经把这套内容放在第10行中。

<merge xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/frameLayoutLatest">
<LinearLayout android:id="@+id/subLinLayoutHeader" android:orientation="horizontal" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content">
    <ImageView android:src="@drawable/layouttriangle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"></ImageView>
</LinearLayout>
<TableLayout android:id="@+id/subLinLayout" android:layout_below="@id/subLinLayoutHeader" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
    <TableRow  android:layout_width="wrap_content" android:layout_height="wrap_content">
        <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
            <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content">
                <!-- list view goes here -->
                <TextView android:layout_gravity="center_vertical|center_horizontal" android:text="Dummy text" android:textColor="#ffffff" android:textSize="16dip"></TextView>
            </ScrollView>
        </LinearLayout>
    </TableRow>
    <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
        <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
            <TableLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TextView android:layout_gravity="center_vertical|center_horizontal" android:text="Latest Articles" android:textColor="#ffffff" android:textSize="16dip"></TextView>
                </TableRow>
        </TableLayout>
        <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content">
         <!--  list view goes here -->
        </ScrollView>
        </LinearLayout>

</TableRow>
</TableLayout>

哪里aldo?

最佳回答

On line 10 of course :) Your code doesn t supply a layout_height or a layout_width for the TextView. Both are required for every xml element.

这是你的法典:

<TextView
android:layout_gravity="center_vertical|center_horizontal"
android:text="Dummy text"
android:textColor="#ffffff"
android:textSize="16dip">
</TextView>

相反(或使用配对——父母,而不是包裹——连续性)

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:text="Dummy text"
android:textColor="#ffffff"
android:textSize="16dip">
</TextView>

EDIT, 解释第二稿件:

Well, I learned something new today. According to the TableRow documentation,

The children of a TableRow do not need to specify the layout_width
and layout_height attributes in the XML file. TableRow always enforces
those values to be respectively MATCH_PARENT and WRAP_CONTENT.

这就造成了错误。

问题回答

页: 1 图表中的观点 对这一文件第10行的看法,需要做一个布局,即:除别的外,该系统将了解你认为你的文本。 如果你不敢肯定哪里开始照抄载有该意见的《意见》中的两项属性。

错误信息是否足够清楚? 某些东西没有布局(两个<代码>>TextView),如果你确定,你的问题很可能将固定下来。





相关问题
Very basic WPF layout question

How do I get this listbox to be maxiumum size, i.e. fill the group box its in. I ve tried width="auto" Height="auto", width="stretch" Height="stretch" annoyingly at the moment, it dynamicly sizes to ...

How to align the text to top of TextView?

How to align the text to top of a TextView? Equivalent Android API for Swings setInsets()? that is top of text should start be in (0,0) of TextView <?xml version="1.0" encoding="utf-8"?> <...

Centring a flow in Shoes

Can I center the contents of a flow in Shoes? I know that a paragraph can be centred like: para Centred paragrpah , :align=> center However, this does not work with flows: flow(:align=> ...

Overlaying with CSS

I want to load a website in an iframe, and overlay the website with some hints about the website that is shown. However, i got stuck at the point that the website has a variable passive white space at ...

How do you normally make a program look beautiful? [closed]

How can I make an Application look nice and not like an amateur pulled it together? I mean graphic-wise. Is there some sort of book you can read regarding beautiful program layouts, etc? I put this ...

热门标签