Using ListView : How to add a header view?

前端 未结 3 2065
无人及你
无人及你 2020-11-27 03:54

I looke at the ListView API and I saw the method:

addHeaderView(View v)

What I want to do is to have a layout above the list,

3条回答
  •  旧时难觅i
    2020-11-27 04:53

    You simply can't use View as a Header of ListView.

    Because the view which is being passed in has to be inflated.

    Look at my answer at Android ListView addHeaderView() nullPointerException for predefined Views for more info.

    EDIT:

    Look at this tutorial Android ListView and ListActivity - Tutorial .

    EDIT 2: This link is broken Android ListActivity with a header or footer

提交回复
热议问题