Why do ListView items not grow to wrap their content?

前端 未结 9 685
猫巷女王i
猫巷女王i 2020-11-30 20:26

I have a rather complex ListView, with variable list item heights. Under certain conditions, I need to display an additional view in a list item, which is hidden by default

9条回答
  •  粉色の甜心
    2020-11-30 21:00

    How are you inflating your rows?

    If you are not using it right now, try using LayoutInflater#inflate(layoutId, parent, false) (where parent is the AdapterView supplied to getView() or newView()):

    v = getLayoutInflater().inflate(R.layout.list_item, parent, false);
    

提交回复
热议问题