布局定义。 "你必须提供一个layout_width属性&QUOT。 [英] Layout definition. "You must supply a layout_width attribute."
问题描述
我正在开发一个小的Android应用程序,我有一个布局的问题,我一直在试图找到错误在我的XML,但我无法找到它...
I'm developing a little android app, and I'm having a problem with a layout, I been trying to find the error in my xml, but I couldn't find it...
我收到的错误是:你必须提供一个layout_width属性,但我做到了,它仍然无法正常工作......
The error I'm getting is "You must supply a layout_width attribute", but I did it and it still doesn't work...
下面是我的XML文件:
Here is my XML file:
<?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:orientation="horizontal"
android:weightSum="100" >
<TextView android:id="@+id/nombreEvento"
android:layout_height="fill_parent"
android:layout_weight="70"
/>
<TextView android:id="@+id/moneda"
android:layout_height="fill_parent"
android:layout_weight="10"
/>
<TextView android:id="@+id/totalEvento"
android:layout_height="wrap_content"
android:layout_weight="20"
/>
</LinearLayout>
<TextView android:id="@+id/fecha"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
任何想法???它的驾驶我疯了!
Any Idea??? It's driving me crazy!
谢谢!
推荐答案
都能跟得上所有TextViews都layout_height layout_weight 的代替layout_height和和 layout_width (也可能是layout_weight) 。试试这个:
Nope all of your TextViews have layout_height and layout_weight instead of layout_height and layout_width (and possibly layout_weight). Try this:
<?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:orientation="horizontal"
android:weightSum="100" >
<TextView android:id="@+id/nombreEvento"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="70"
/>
<TextView android:id="@+id/moneda"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="10"
/>
<TextView android:id="@+id/totalEvento"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="20"
/>
</LinearLayout>
<TextView android:id="@+id/fecha"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
这篇关于布局定义。 &QUOT;你必须提供一个layout_width属性&QUOT。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!