List of usage examples for android.widget ListView addHeaderView
public void addHeaderView(View v, Object data, boolean isSelectable)
From source file:com.github.mobile.gauges.ui.TrafficListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (gauge != null && gaugeId == null) gaugeId = gauge.getId();//from ww w. j av a 2 s . co m ListView listView = getListView(); if (getListAdapter() == null) { listView.addHeaderView(getLayoutInflater(savedInstanceState).inflate(layout.traffic_graph, null), null, false); listView.addHeaderView( getLayoutInflater(savedInstanceState).inflate(layout.traffic_list_item_labels, null), null, false); } listView.setSelector(android.R.color.transparent); listView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); listView.setDrawSelectorOnTop(false); listView.setFastScrollEnabled(true); listView.setDividerHeight(0); }
From source file:net.niyonkuru.koodroid.ui.TabDetailFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); View header = mContext.getLayoutInflater().inflate(R.layout.tab_list_item_labels, lv, false); lv.addHeaderView(header, null, false); lv.setDividerHeight(0);/*w w w . j a va2s.c om*/ mAdapter = new TabTransactionAdapter(mContext); setListAdapter(mAdapter); setListShown(false); }
From source file:com.battlelancer.seriesguide.ui.FixGetGlueCheckInActivity.java
@Override protected void onCreate(Bundle args) { super.onCreate(args); setContentView(R.layout.activity_fix_get_glue); setupActionBar();//from w w w . java2 s .c o m setupViews(); // do not check for null, we want to crash if so mShowId = getIntent().getExtras().getString(InitBundle.SHOW_TVDB_ID); mAdapter = new GetGlueObjectAdapter(this); ListView list = (ListView) findViewById(R.id.listViewGetGlueResults); list.addHeaderView(mHeaderView, null, false); list.addFooterView(mFooterView, null, false); list.setAdapter(mAdapter); list.setOnItemClickListener(this); // query for show title final Cursor show = getContentResolver().query(Shows.buildShowUri(mShowId), new String[] { Shows._ID, Shows.TITLE, Shows.GETGLUEID }, null, null, null); if (show != null) { if (show.moveToFirst()) { String glueId = show.getString(2); if (!TextUtils.isEmpty(glueId)) { mSelectedValue.setText(glueId); } String query = show.getString(1); Bundle loaderArgs = new Bundle(); loaderArgs.putString("query", query); getSupportLoaderManager().initLoader(0, loaderArgs, this); } show.close(); } }
From source file:com.parse.f8.other.ScheduleFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.track_schedule_layout, container, false); ((TextView) v.findViewById(R.id.track_title)).setText(scheduleTitles[track]); ((TextView) v.findViewById(R.id.track_time)).setText(scheduleTimes[track]); talkLayout = (LinearLayout) v.findViewById(R.id.color_block); if (isFavoriteBreakTalk) { talkLayout.setBackgroundColor(getResources().getColor(R.color.navy)); trackDescriptionTextView = ((TextView) v.findViewById(R.id.track_description)); } else {// w w w.j ava2 s . c o m View header = inflater.inflate(R.layout.list_header_view, null); trackDescriptionHeaderTextView = (TextView) header.findViewById(R.id.track_description_header); ListView list = (ListView) v.findViewById(R.id.talk_list_view); list.addHeaderView(header, null, false); list.setAdapter(adapter); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // The list has a header, offset adapter position by // 1 Talk talk = adapter.getItem(position - 1); if (!talk.isBreak()) { Intent intent = new Intent(getActivity(), TalkActivity.class); intent.setData(talk.getUri()); startActivity(intent); } } }); updateView(); } return v; }
From source file:com.github.mobile.gauges.ui.ReferrerListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView listView = getListView(); listView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); listView.setFastScrollEnabled(true); listView.setDividerHeight(0);/*from w ww. j a v a2 s . com*/ if (getListAdapter() == null) listView.addHeaderView( getActivity().getLayoutInflater().inflate(layout.referrer_list_item_labels, null), null, false); }
From source file:com.github.mobile.gauges.ui.ContentListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView listView = getListView(); listView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); listView.setFastScrollEnabled(true); listView.setDividerHeight(0);//from ww w .jav a2 s. c o m if (getListAdapter() == null) listView.addHeaderView(getActivity().getLayoutInflater().inflate(layout.content_list_item_labels, null), null, false); }
From source file:org.jraf.android.hellomundo.app.pickwebcam.PickWebcamListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View res = super.onCreateView(inflater, container, savedInstanceState); // Add 'random' item ListView listView = (ListView) res.findViewById(android.R.id.list); setListAdapter(mAdapter);/*from ww w . ja v a 2 s.co m*/ mAdapter.setListView(listView); listView.addHeaderView(getHeaderView(listView), null, true); // Disable dividers since they are handled manually in cell layouts listView.setDividerHeight(0); // Disable this optimization because this cause problems on dividers in hdpi listView.setScrollingCacheEnabled(false); // Layout animation listView.setLayoutAnimation(AnimationUtils.loadLayoutAnimation(getActivity(), R.anim.listview_layout)); return res; }
From source file:com.example.demo_dv_fuse.DetailsTab.java
/** * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, * android.os.Bundle)//from www . j av a2 s .co m */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.details_tab, container, false); final String[] choices = { getString(R.string.viewAirportMaps), getString(R.string.viewGoogleMap) }; final ListView listView = (ListView) view.findViewById(R.id.detailsList); final View headerView = inflater.inflate(R.layout.details_list_header, null); listView.addHeaderView(headerView, null, false); listView.setAdapter(new ArrayAdapter<String>(container.getContext(), R.layout.details_row, R.id.details_list_map_row_title, choices)); listView.setClickable(true); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { /** * @see android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget.AdapterView, * android.view.View, int, long) */ @Override public void onItemClick(final AdapterView<?> adapterView, final View parent, final int position, final long id) { if (position == AIRPORT_MAPS_INDEX) { handleViewAirportMapsSelected(); } else if (position == GOOGLE_MAPS_INDEX) { handleViewGoogleMap(); } } }); // departure widgets this.departureAirlines = (TextView) view.findViewById(R.id.departure_airlines); this.departureAirportCode = (TextView) view.findViewById(R.id.departure_airport_code); this.departureFlightNumber = (TextView) view.findViewById(R.id.departure_flight_number); this.departureIata = (TextView) view.findViewById(R.id.departure_iata); this.departureStatus = (TextView) view.findViewById(R.id.departure_status); this.departureTime = (TextView) view.findViewById(R.id.departure_time); // arrival widgets this.arrivalAirportCode = (TextView) view.findViewById(R.id.arrival_airport_code); this.arrivalGate = (TextView) view.findViewById(R.id.arrival_gate); this.arrivalTerminal = (TextView) view.findViewById(R.id.arrival_terminal); this.arrivalTime = (TextView) view.findViewById(R.id.arrival_time); return view; }
From source file:net.niyonkuru.koodroid.ui.DataDetailFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); /* load data again to be used by the graph */ getLoaderManager().initLoader(0, null, this); ListView lv = getListView(); LayoutInflater inflater = LayoutInflater.from(mContext); View graph = inflater.inflate(R.layout.usage_graph, lv, false); lv.addHeaderView(graph, null, false); View header = inflater.inflate(R.layout.usage_list_item_labels, lv, false); lv.addHeaderView(header, null, false); lv.setDividerHeight(0);//w w w. java2 s. c o m mAdapter = new UsageAdapter(mContext); setListAdapter(mAdapter); setListShown(false); }
From source file:com.fututel.ui.chat.ChatListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true);//from w w w.j a va 2s .co m ListView lv = getListView(); if (getListAdapter() == null && mHeaderView != null) { lv.addHeaderView(mHeaderView, null, true); } lv.setOnCreateContextMenuListener(this); }