Logcat error: “addView(View, LayoutParams) is not supported in AdapterView” in a ListView

前端 未结 5 1282
误落风尘
误落风尘 2020-12-01 10:22

I\'m doing an application for Android and something I need is that it shows a list of all files and directories in the SD Card and it has to be able to move through the diff

5条回答
  •  Happy的楠姐
    2020-12-01 10:56

    my problem was this: I override getView in arrayAdapter. then when I inflated view, I forgot to set attach to root to false and that caused this exception.

    this is how must be done:

    convertView = LayoutInflater.from(getContext()).inflate(R.layout.market_search_product_view, parent,false);
    

    after that problem solved!

提交回复
热议问题