ListView addHeaderView - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ListView addHeaderView method.

This code example shows how to use the following methods:addHeaderView, setAdapter, setEmptyView, setFocusable, setOnItemClickListener
		super.onCreate(savedInstanceState);
 
		if (listViewId != 0) {
			listView = findListViewById(listViewId);
			if (headerView() != null) { 
				listView.addHeaderView(headerView());
			} 
			listView.setOnItemClickListener(this);
			android.view.View emptyView = findViewById(android.R.id.empty);
			if (emptyView != null) {
				listView.setEmptyView(emptyView);
			} 
 
			adapter = Objects.createInstance(adapterClass, Context.class, this);
			listView.setAdapter(adapter);
			listView.setFocusable(true);
		} 
	} 
 
	/** 
	 * Called after ListAdapter has been loaded 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addHeaderView
		LinearLayout outerContainer = new LinearLayout(context);
		AbsListView.LayoutParams layoutParams = new AbsListView.LayoutParams(AbsListView.LayoutParams.FILL_PARENT, AbsListView.LayoutParams.WRAP_CONTENT);
		outerContainer.setLayoutParams(layoutParams);
		outerContainer.setOrientation(LinearLayout.VERTICAL);
		outerContainer.addView(subView);
		listView.addHeaderView(outerContainer);
	} 
	 
	@Override 
	public HeaderVisibility createVisibility(ListView listView, View subView)
	{ 
		return new HeaderVisibility(subView);
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAdapter, addHeaderView
	private void populateHeaderView() { 
		// TODO: Populate the damn header.  
	} 
	 
	private void populateMainView() { 
		listView.addHeaderView(headerView);
		listView.setAdapter(episodeArchiveAdapter);
	} 
	 
	private class LoadEpisodesAsyncTask extends AsyncTask<Void, Void, List<Episode>> {
		@Override 
		protected List<Episode> doInBackground(Void... params) {
			try { 
				return IBClient.getEpisodes(0, 10); 
			} catch (IOException e) {
				e.printStackTrace();
				return null; 
			} 
		} 
		 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related ListView addHeaderView Questions & Answers:

addHeaderView Method Overview
Add a fixed view to appear at the top of the list.
See Code Examples for other Android ListView Methods: