You must supply a resource ID for a TextView android error

后端 未结 4 1805
清酒与你
清酒与你 2020-12-03 10:08

I try all this day to resolve this error. I don\'t understand why my logcat prints:

05-06 21:45:59.559:
ERROR/ConversationList(9023): We have
chats... 05-06 21:45:         


        
4条回答
  •  生来不讨喜
    2020-12-03 11:02

    I'm pretty sure the problem lies in your conversation_item layout. The docs state that you must provide a resource with a single TextView. What does that layout look like?

    As an example, this is what the simple_list_item_1 layout looks like, yours should be pretty similar.

    
    
    

    EDIT:

    I just edited the question so your layout will show. Your layout is indeed wrong, you cannot have the linear layout there if you're using that constructor. You can use the other constructor ( ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects) ) and provide your custom layout and your TextView's id.

提交回复
热议问题