今天将Android Turtories上的ListView例子copy进去跑了下,出现一个错误

ArrayAdapter requires the resource ID to be a TextView。

上网查了下,说是TextView要是第一个元素,我的XML代码如下,确实是直接的元素,错哪儿了呢?实在找不出来,就把第一句的“<?xml version="1.0" encoding="utf-8"?>”删掉试试,居然可以了·····记住啦·····

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns: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>

 

相关文章:

  • 2021-07-07
  • 2021-12-07
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2021-06-05
  • 2021-12-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2022-01-21
相关资源
相似解决方案