listView


java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView

自己定义了一个ListItem的xml文件,里面有个textView,结果报出这样一个错误,上网查了之后,发现要求必须这样写:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/city"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="30sp" />

TextView必须是根节点原来是这个意思啊

你可能感兴趣的:(listView)