简体   繁体   中英

How to set multiple id with ArrayAdapter?

Here is my declared ArrayAdapter :

itemsAdapter = new ArrayAdapter<String>(this,
            R.layout.activity_task,
            R.id.taskTitle,
            items1);

I wanted to do that :

itemsAdapter = new ArrayAdapter<String>(this,
            R.layout.activity_task,
            R.id.taskTitle,
            items1,
            R.id.taskNews,
            items2);

Because, my app is like :

  • Task 1
  • Task 2

And, I'm trying to do :

  • Task 1
  • Task's description 1
  • Task 2
  • Task's description 2

How it's possible to add multiple id ?

If you are using list view to show the text items, then you can only use one layout and one text view using standard ArrayAdapter.

To use two TextView's try making a CustomListAdapter

Use this link for reference on CustomListAdapter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM