Example usage for android.widget ListView setHeaderDividersEnabled

List of usage examples for android.widget ListView setHeaderDividersEnabled

Introduction

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

Prototype

public void setHeaderDividersEnabled(boolean headerDividersEnabled) 

Source Link

Document

Enables or disables the drawing of the divider for header views.

Usage

From source file:com.redwoodsystems.android.apps.LightingListFragment.java

private void setupScenesList() {
    Log.d(TAG, "setupScenesList called");
    ListView listView = (ListView) getActivity().findViewById(android.R.id.list);
    TextView dummy = new TextView(getActivity());
    ImageView dummy2 = new ImageView(getActivity());
    listView.addFooterView(dummy, null, true);
    listView.setFooterDividersEnabled(true);
    listView.addHeaderView(dummy2, null, true);
    listView.setHeaderDividersEnabled(true);
    int[] colors = { 0, 0xFFF47836, 0 }; // Pantone172 for the example
    listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
    listView.setDividerHeight(1);/*from w  ww .j  av a2  s. com*/

    //TODO: set Empty Text inside View
    //setEmptyText("No Scenes found");

    mSceneAdapter = new SceneAdapter(getActivity(), R.layout.scene_item_layout, R.id.sceneText);

    setListAdapter(mSceneAdapter);

    Uri dummyUri = null;
    Bundle params = new Bundle();
    Bundle args = new Bundle();
    args.putParcelable(ARGS_URI, dummyUri);
    args.putParcelable(ARGS_PARAMS, params);

    // Initialize the Loader.
    Log.d(TAG, "calling initLoader..");
    getActivity().getSupportLoaderManager().initLoader(LOADER_SCENES, null, this);

}

From source file:com.gdgdevfest.android.apps.devfestbcn.ui.ExploreFragment.java

private void addMapHeaderView() {
    ListView listView = getListView();
    final Context context = listView.getContext();
    View mapHeaderContainerView = LayoutInflater.from(context).inflate(R.layout.list_item_track_map, listView,
            false);//from  w w  w .j  a v  a  2 s  . co m

    View mapButton = mapHeaderContainerView.findViewById(R.id.map_button);
    mapButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // Launch map of conference venue
            EasyTracker.getTracker().sendEvent("Explore Tab", "Click", "Map", 0L);
            startActivity(new Intent(context, UIUtils.getMapActivityClass(getActivity())));
        }
    });

    listView.addHeaderView(mapHeaderContainerView);
    listView.setHeaderDividersEnabled(false);
}