First of all, we must add a ListView into main layout (main.xml file)
Next, create a list_item.xml file - this file will define all the components, controls of EACH ITEM in ListView.
Create a SongInfo class to define all the information of a song object like song, singer, isCheck, rate:
Now, it’s time to play with Custom List View
Create new ListItem class that extends the LinearLayout super class.
This class will declare all the components and controls in list_item.xml file:
Create new ListAdapter class extends ArrayAdapter<SongInfo> super class:
Override the getView method to assign values of SongInfo to the appropriate components, controls in a ListView item.
In the ListViewDemoActivity class, onCreate() method, we need to init and push some dummy data to ListAdapter, after that setAdapter for ListView: