Skip to content

Instantly share code, notes, and snippets.

@Gowiem
Created June 13, 2012 19:12
Show Gist options
  • Save Gowiem/2925853 to your computer and use it in GitHub Desktop.
Save Gowiem/2925853 to your computer and use it in GitHub Desktop.
Adding Header to List Code
setContentView(R.layout.list);
final ListView installationListView = getListView();
LayoutInflater inflater = getLayoutInflater();
ViewGroup header = (ViewGroup) inflater.inflate(R.layout.header, installationListView, false);
TextView headerText = (TextView) header.findViewById(R.id.header_text);
headerText.setText("Installations On Live"); // TODO: This should not be hardcoded
installationListView.addHeaderView(header, null, false);
setListAdapter(new ArrayAdapter<Installation>(InstallationListActivity.this, android.R.layout.simple_list_item_1, installations));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment