Adapter for a custom layout of listview

前端 未结 3 1596
自闭症患者
自闭症患者 2021-01-25 07:24

I am developing an android project in which I have to load from group of String arrays(say title,description,id) to the listview item TextView.

I did something similar w

3条回答
  •  臣服心动
    2021-01-25 07:44

    First of all you need to create a Class that holds that information, something like:

    public class StringHolder{
        String titte;
        String description;
        int id;
    }
    

    Then you create the layout of your row that says where you want your title, your description and your image.

    Then you create an Adapter. The adapter will hold your data and will say for each position in the list what information should be loaded.

    At last you need to use your adapter in an activity.

    For more information you can see a tutorial here: http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/

提交回复
热议问题