Q: ArrayAdapter requires the resource ID to be a TextView
2015-04-17 17:00
597 查看
Q:
Error Msg: ArrayAdapter requires the resource ID to be a TextView
A:
The ArrayAdapter requires the resource ID to be a TextView XML exception means you don't supply what the
When you use this constructor:
be the id of a xml layout file containing only a
wrapped by another layout, like a
something like this:
If you want your list row layout to be something a little different then a simple
use this constructor:
where you supply the
a layout that can contain various views, but also must contain a
and
third parameter) that you pass to your
it can know where to put the
the row layout.
Refer:
http://blog.csdn.net/xxg3053/article/details/6999872 http://stackoverflow.com/questions/9280965/arrayadapter-requires-the-resource-id-to-be-a-textview-xml-problems
Error Msg: ArrayAdapter requires the resource ID to be a TextView
A:
The ArrayAdapter requires the resource ID to be a TextView XML exception means you don't supply what the
ArrayAdapterexpects.
When you use this constructor:
new ArrayAdapter<String>(this, R.layout.a_layout_file, this.file)
R.Layout.a_layout_filemust
be the id of a xml layout file containing only a
TextView(the
TextViewcan't be
wrapped by another layout, like a
LinearLayout,
RelativeLayoutetc!),
something like this:
<?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="wrap_content" // other attributes of the TextView />
If you want your list row layout to be something a little different then a simple
TextViewwidget
use this constructor:
new ArrayAdapter<String>(this, R.layout.a_layout_file, R.id.the_id_of_a_textview_from_the_layout, this.file)
where you supply the
idof
a layout that can contain various views, but also must contain a
TextViewwith
and
id(the
third parameter) that you pass to your
ArrayAdapterso
it can know where to put the
Stringsin
the row layout.
Refer:
http://blog.csdn.net/xxg3053/article/details/6999872 http://stackoverflow.com/questions/9280965/arrayadapter-requires-the-resource-id-to-be-a-textview-xml-problems
相关文章推荐
- ArrayAdapter requires the resource ID to be a TextView错误
- 如何解决ArrayAdapter requires the resource ID to be a TextView
- 如何解决ArrayAdapter requires the resource ID to be a TextView
- ArrayAdapter requires the resource ID to be a TextView问题
- ArrayAdapter requires the resource ID to be a TextView问题整理
- ArrayAdapter requires the resource ID to be a TextView 的解决办法
- ArrayAdapter requires the resource ID to be a TextView问题
- ArrayAdapter requires the resource ID to be a TextView问题
- ArrayAdapter requires the resource ID to be a TextView问题
- ArrayAdapter requires the resource id to be a TextView
- 关于出现 ArrayAdapter requires the resource ID to be a TextView问题
- ArrayAdapter requires the resource ID to be a TextView
- ArrayAdapter requires the resource ID to be a TextView问题
- 如何解决ArrayAdapter requires the resource ID to be a TextView
- 报错:ArrayAdapter requires the resource ID to be a TextView
- ArrayAdapter requires the resource ID to be a TextView错误
- ArrayAdapter requires the resource ID to be a TextView问题
- ArrayAdapter requires the resource ID to be a TextView错误
- ArrayAdapter的用法:ArrayAdapter(Context context, int textViewResourceId, T[] objects)