Levimatt
Levimatt

Reputation: 453

Footerview not displaying always when scrolling the listview

I have a listview with an adapter. I want to add a footer and that this footer will be displayed when scrolling the listview. Right now with this code the footerview is displayed when the listview is finished. In the onCreate method of the list i have:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listado_imagenes_subidas_main);

    // load list application
    listImagenes = (ListView)findViewById(R.id.lvImages);

    LayoutInflater inflater = getLayoutInflater();
    ViewGroup footer = (ViewGroup) inflater.inflate(R.layout.footer3buttons, listImagenes,
            false);
    listImagenes.addFooterView(footer, null, false);

    // create new adapter
    ImagenesAdapter adapter = new ImagenesAdapter(this, ListadoImagenes());
    // set adapter to list view
    listImagenes.setAdapter(adapter);
}

Could you please help me with this issue?

Thank you in advanced.

Upvotes: 0

Views: 388

Answers (2)

forcewill
forcewill

Reputation: 1647

If i understood correctly what you wan't is a "sticky" footer the addFooterView method add a footer after the last view item, for a sticky footer you have to roll your own, or use an external library for it.

Upvotes: 1

Arpit Patel
Arpit Patel

Reputation: 1571

try with this one

View footerView =  ((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer_layout, null, false);
list.addFooterView(footerView);

Upvotes: 0

Related Questions