我正在创建一个使用位于res文件夹下的schedule_layout.xml文件的android应用,但出现此错误,“ Android缺少Android名称空间前缀”。这是什么意思?我该如何解决?

<?xml version="1.0" encoding="utf-8"?>
<ListView
    android:id="@+id/schedule"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
</ListView>

最佳答案

使用以下

<?xml version="1.0" encoding="utf-8"?>
<ListView
    xmlns:android="http://schemas.android.com/apk/res/android" //missing
    android:id="@+id/schedule"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
</ListView>


也检查一下

Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file?

09-30 17:56
查看更多