Example usage for android.widget ListView addHeaderView

List of usage examples for android.widget ListView addHeaderView

Introduction

In this page you can find the example usage for android.widget ListView addHeaderView.

Prototype

public void addHeaderView(View v) 

Source Link

Document

Add a fixed view to appear at the top of the list.

Usage

From source file:Main.java

public static View addListViewHeaderView(ListView listview, int layoutId, Context context) {
    LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = mInflater.inflate(layoutId, null);
    listview.addHeaderView(view);
    return view;//ww w . j  av  a 2  s.  c om
}

From source file:com.gmall.gmallmanager.widget.recyclerAndCardView.scroll.BaseFragment.java

protected void setDummyDataWithHeader(ListView listView, View headerView) {
    listView.addHeaderView(headerView);
}

From source file:com.aaa.activity.main.BaseFragment.java

protected void setDummyDataWithHeader(ListView listView, View headerView) {
    listView.addHeaderView(headerView);
    setDummyData(listView);
}

From source file:com.cnpaypal.ObservableScrollView.BaseActivity.java

protected void setDummyDataWithHeader(ListView listView, View headerView, int num) {
    listView.addHeaderView(headerView);
    setDummyData(listView, num);/*from   www.  jav  a 2s.  co m*/
}

From source file:hr.kodbiro.quickbyte.activities.TrolleyActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // get Intent from MenuActivity with orderList
    Intent intent = getIntent();/*from w  w w.  j  a va 2 s  . c o  m*/
    orderList = intent.getParcelableArrayListExtra("orderList");
    TrolleyListAdapter trolleyListAdapter = new TrolleyListAdapter(getApplicationContext(), orderList);

    // add list header
    View header = getLayoutInflater().inflate(R.layout.listview_header_trolley, null);
    header.setClickable(false);
    ListView listView = getListView();
    listView.addHeaderView(header);

    // populate ListView
    getListView().setAdapter(trolleyListAdapter);

    alertDialogBuilder = new AlertDialog.Builder(this);
}

From source file:com.social.solution.activity.TrendingTweetsActivity.java

void setmydata(ListView listView, View headerView) {
    listView.addHeaderView(headerView);
}

From source file:nz.ac.otago.psyanlab.common.designer.subject.SubjectFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_designer_subject, container, false);
    ListView list = (ListView) view.findViewById(R.id.list);
    list.addHeaderView(inflater.inflate(R.layout.header_subject_details, list, false));
    return view;/* w w  w .ja  v a 2 s  .  co  m*/
}

From source file:at.ac.tuwien.detlef.fragments.PodListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View view = inflater.inflate(R.layout.pod_fragment_layout, container, false);

    /* Add the 'All Podcasts' header and empty views. */

    ListView listView = (ListView) view.findViewById(android.R.id.list);
    listView.addHeaderView(allPodcasts);
    listView.setEmptyView(getLayoutInflater(getArguments()).inflate(R.layout.pod_list_empty, null));

    return view;/*w w  w.  j  av a2 s .c o  m*/
}

From source file:me.johnmh.boogdroid.ui.BugInfoFragment.java

@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final AppCompatActivity activity = (AppCompatActivity) getActivity();

    ListView listView = getListView();
    listView.addHeaderView(mainView);

    final AdapterComment adapter = new AdapterComment(activity, bug.getComments());

    EditText editCommentFilter = (EditText) mainView.findViewById(R.id.editCommentFilter);
    editCommentFilter.addTextChangedListener(new TextWatcher() {
        @Override/* w  ww  .  j a v a  2s  .co m*/
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            adapter.getFilter().filter(s.toString());
        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });

    View footer = ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.footer_comment, null, false);

    final EditText editComment = (EditText) footer.findViewById(R.id.editComment);
    editComment.setText("");
    Button addComment = (Button) footer.findViewById(R.id.addComment);
    addComment.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String comment = JSONObject.quote(editComment.getText().toString());
            final Server server = bug.getProduct().getServer();
            final BugzillaTask task = new BugzillaTask(server, "Bug.add_comment",
                    "'id':" + bug.getId() + ", 'comment': " + comment, new Util.TaskListener() {

                        @Override
                        public void doInBackground(final Object response) {
                            if (server.isUseJson()) {
                                doJsonParse(response);
                            } else {
                                doXmlParse(response);
                            }
                        }

                        private void doJsonParse(Object response) {
                            //TODO: It returns the new comment id. So you could only reload that one
                            try {
                                System.out.println(response);
                            } catch (final Exception e) {
                                e.printStackTrace();
                            }
                        }

                        private void doXmlParse(Object response) {
                            //TODO: It returns the new comment id. So you could only reload that one
                            try {
                                System.out.println(response);
                            } catch (final Exception e) {
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void onPostExecute(final Object response) {
                            updateView();
                            bug.loadComments();
                        }
                    });
            task.execute();
        }
    });
    listView.addFooterView(footer);

    setListAdapter(adapter);
    bug.setAdapterComment(adapter, activity, this);
}

From source file:nz.ac.otago.psyanlab.common.PaleDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_pale_detail, container, false);
    ListView records = (ListView) v.findViewById(R.id.records);
    records.addHeaderView(inflater.inflate(R.layout.header_pale_detail, records, false));
    return v;//from   ww w  .j a v  a 2s. co  m
}