Trouble with ListView

后端 未结 3 1038
陌清茗
陌清茗 2021-01-17 00:44

I have an issue with my Main Activity and a ListView and I absolutly don\'t understand how it works...

OK ! This is what I want :

Expectation

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-17 01:38

    listview has to have its own layout, so you need to create a new layout that just contains listview and in getView() method use it as a row of your listView

    1- create a new row_listview.xml

    
    
    
    
    
    
    
    
    

    2-Change this line

        view = inflater.inflate(R.layout.activity_main_menu, null);
    

    to

        view = inflater.inflate(R.layout.row_listview, null);
    

提交回复
热议问题