Trouble with ListView

后端 未结 3 1037
陌清茗
陌清茗 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:34

    You should not use R.layout.activity_main_menu in getView, because getView returns a line of the list which you don't want to have a button.

    So, you have a separate layout activity_main_men specified as Content view for the activity which does not have TextView:

    
    
    
    
    
    

    The in getView instead of

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

    you just place:

    view = new TextView()
    view.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    

提交回复
热议问题