Back to project page StikkyHeader.
The source code is released under:
Apache License
If you think the Android project StikkyHeader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package it.carlom.stickyheader.example.fragment; //from w ww . ja v a2s . co m import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.FrameLayout; import android.widget.ListView; import it.carlom.stickyheader.example.R; import it.carlom.stickyheader.example.animator.IO2014HeaderAnimator; import it.carlom.stikkyheader.core.StikkyHeaderBuilder; /** * A simple {@link Fragment} subclass. */ public class IO2014HeaderFragment extends Fragment { private ListView mListView; public IO2014HeaderFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_simplelistview, container, false); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mListView = (ListView) getView().findViewById(R.id.listview); } @Override public void onStart() { super.onStart(); getActivity().getActionBar().hide(); } @Override public void onStop() { super.onStop(); getActivity().getActionBar().show(); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); IO2014HeaderAnimator animator = new IO2014HeaderAnimator(getActivity()); StikkyHeaderBuilder.stickTo(mListView) .addHeader(R.layout.header_io2014, (FrameLayout) getView().findViewById(R.id.layout_container)) .minHeightHeaderRes(R.dimen.min_height_header_materiallike) .animator(animator) .build(); populateListView(); } private void populateListView() { String[] elements = new String[500]; for (int i = 0; i < elements.length; i++) { elements[i] = "row " + i; } mListView.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, elements)); } }