Android布局文件xml问题

Ronys 2011-10-21 01:25:54
为什么我使用下面那个文件:item_view.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/fileList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:background="@drawable/white">
</TextView>
</LinearLayout>
然后再
ArrayAdapter<String>adapter= new ArrayAdapter<String>(this,R.layout.item_view,songs);
setListAdapter(adapter);
直接就报错强制关闭程序
而是用下面这个文件就不会:
...全文
62 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ronys 2011-10-21
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/i"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textColor="#205"
android:cursorVisible="true"
android:padding="20dp">
</TextView>
就不会呢,第一个xml不是布局文件的正确格式吗?而这种(也就是第二种)怎么看都觉得怪。。

50,523

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧