Advertisement
felipearon

ListView Footer with List

Jun 9th, 2014
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. lvItens = (ListView) view.findViewById(R.id.lvItens);
  2.            
  3. List<String> lista = new ArrayList<String>();
  4. lista.add("Item 1");
  5. lista.add("Item 2");
  6. lista.add("Item 3");
  7. lista.add("Item 4");
  8. lista.add("Item 5");
  9.            
  10. ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, lista);
  11.            
  12. View viewFooter = LayoutInflater.from(getActivity()).inflate(R.layout.listview_footer, null, false);
  13.            
  14. ListView lvItensFooter = (ListView) viewFooter.findViewById(R.id.lvItens);
  15.            
  16. List<String> listaFooter = new ArrayList<String>();
  17. listaFooter.add("Footer 1");
  18. listaFooter.add("Footer 2");
  19. listaFooter.add("Footer 3");
  20.            
  21. ArrayAdapter<String> adapterFooter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, listaFooter);
  22.            
  23. lvItensFooter.setAdapter(adapterFooter);
  24.            
  25. lvItens.addFooterView(viewFooter);                  
  26. lvItens.setAdapter(adapter);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement