现在的位置: 首页 > 综合 > 正文

You must supply a resourceID for a TextView

2018年05月11日 ⁄ 综合 ⁄ 共 424字 ⁄ 字号 评论关闭

问题:

新手在初次接触ListView时候喜欢采用简单的ArrayAdpter,由于布局文件xml书写不正确,经常会出现You must supply a resourceID for a TextView的错误。

解决途径:

我们只需要按照安卓官方示例代码里的xml布局文件来修改一下即可,请不要增加或减少textview之类的,因为这和ArrayAdapter的机制有关。

<?xml version="1.0" encoding="utf-8"?>
<TextViewxmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp"
    android:textSize="16sp">
</TextView>

抱歉!评论已关闭.