LinearLayout元素缺少所需的属性layout_height。

3
每个TextView、Button以及LinearLayout标签都在抱怨。
'layout_height' attribute should be defined

'layout_width' attribute should be defined 

这是我的activity_main.xml文件:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/rest/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:text="@string/main_title" />
<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/continue_label" />
<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/new_game_label" />
<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/about_label" />
<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/exit_label" />
</LinearLayout>

我正在使用 Android Studio 1.1.0

1个回答

5

将您的xmlns属性更改为:

xmlns:android="http://schemas.android.com/apk/res/android"

/res/不是/rest/


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接