How to add a sub item in Android ListView?

前端 未结 4 790
礼貌的吻别
礼貌的吻别 2021-02-08 16:03

I have made a android listView taking the help from Vogella.com using following layout and ListActivity class.

RowLayout.xml



        
4条回答
  •  清酒与你
    2021-02-08 16:35

    A ListView item can have it's own custom layout. When you create your adapter for the ListView you can pass in the layout id to the Adapter constructor. See SimpleAdapter and ArrayAdapter.

    If you want to show some more details like image and text or two textview then You will have to extend an Adapter and implement getView() to property set the image+text.

    Check out Custom ListView

    And if you want to categorize the ListView in sections then you should go for the Section ListView in Android also check Section Header in ListView

提交回复
热议问题