Example usage for android.widget ListView setDivider

List of usage examples for android.widget ListView setDivider

Introduction

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

Prototype

public void setDivider(@Nullable Drawable divider) 

Source Link

Document

Sets the drawable that will be drawn between each item in the list.

Usage

From source file:Main.java

public static void setDivider(ListView listView) {
    listView.setDivider(gradient);
    listView.setDividerHeight(1);

}

From source file:org.mariotaku.twidere.fragment.support.BaseActivitiesListFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mAdapter = createListAdapter(getActivity());
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    setListAdapter(mAdapter);// ww  w.  j  a  va  2 s  .co  m
    final ListView lv = getListView();
    lv.setDivider(null);
    lv.setSelector(android.R.color.transparent);
    getLoaderManager().initLoader(0, getArguments(), this);
    setListShown(false);
}

From source file:eu.geopaparazzi.library.forms.FormListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    List<String> fragmentTitles = mFragmentListSupporter.getListTitles();

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
            android.R.layout.simple_list_item_activated_1,
            fragmentTitles.toArray(new String[fragmentTitles.size()]));

    int color = Compat.getColor(getActivity(), R.color.formcolor);
    int[] colors = { 0, color, 0 };
    ListView listView = getListView();
    listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
    listView.setDividerHeight(2);//from  ww w .ja  v a2 s  .  c o  m

    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    listView.setFocusableInTouchMode(true);
    StateListDrawable selector = new StateListDrawable();
    selector.addState(new int[] { -android.R.attr.state_pressed },
            new ColorDrawable(Compat.getColor(getContext(), R.color.main_selection)));
    listView.setSelector(selector);

    setListAdapter(adapter);

    if (fragmentTitles.size() > 0)
        listView.setItemChecked(0, true);
}

From source file:org.hedgewars.hedgeroid.ChatFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_chat, container, false);

    ListView listView = (ListView) view.findViewById(R.id.chatConsole);
    listView.setAdapter(adapter);//  www.j a  va 2 s.com
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setVerticalFadingEdgeEnabled(true);

    EditText editText = (EditText) view.findViewById(R.id.chatInput);
    editText.setOnEditorActionListener(new ChatSendListener());

    return view;
}

From source file:org.simlar.ContactsListFragment.java

@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
    final ListView listView = getListView();

    if (listView == null) {
        Lg.e(LOGTAG, "no list view");
        return;/*from w w w .  j  a v a2s  .c o m*/
    }

    listView.setDivider(null);
}

From source file:de.vanita5.twittnuker.fragment.support.BaseActivitiesListFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    final boolean plainListStyle = mPreferences.getBoolean(KEY_PLAIN_LIST_STYLE, false);
    final boolean compactCards = mPreferences.getBoolean(KEY_COMPACT_CARDS, false);
    mAdapter = createListAdapter(getActivity(), compactCards, plainListStyle);
    setListAdapter(mAdapter);/*from   ww  w.  j  ava 2  s.co  m*/
    final ListView lv = getListView();
    if (!plainListStyle) {
        lv.setDivider(null);
    }
    lv.setSelector(android.R.color.transparent);
    getLoaderManager().initLoader(0, getArguments(), this);
    setListShown(false);
}

From source file:com.amaze.carbonfilemanager.fragments.AppsList.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);/*from www .  j  ava  2  s  . c o  m*/
    MainActivity mainActivity = (MainActivity) getActivity();
    mainActivity.setActionBarTitle(getResources().getString(R.string.apps));
    mainActivity.floatingActionButton.hideMenuButton(true);
    mainActivity.buttonBarFrame.setVisibility(View.GONE);
    mainActivity.supportInvalidateOptionsMenu();
    vl = getListView();
    Sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    getSortModes();
    ListView vl = getListView();
    vl.setDivider(null);
    if (utilsProvider.getAppTheme().equals(AppTheme.DARK))
        getActivity().getWindow().getDecorView()
                .setBackgroundColor(Utils.getColor(getContext(), R.color.holo_dark_background));

    adapter = new AppsAdapter(getContext(), (BaseActivity) getActivity(), utilsProvider, R.layout.rowlayout,
            app);
    setListAdapter(adapter);
    setListShown(false);
    setEmptyText(getResources().getString(R.string.no_applications));
    getLoaderManager().initLoader(ID_LOADER_APP_LIST, null, this);

    if (savedInstanceState != null) {

        index = savedInstanceState.getInt("index");
        top = savedInstanceState.getInt("top");
    }
}

From source file:com.github.mobile.gauges.ui.GaugeListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    ListView listView = getListView();
    listView.setCacheColorHint(getResources().getColor(android.R.color.transparent));
    listView.setDivider(getResources().getDrawable(drawable.gauge_divider));
    listView.setDividerHeight(2);// w  w  w .  java2s . com
    listView.setFastScrollEnabled(true);
}

From source file:bus_vn.gena.bus_vn.com.bus_vn.tabs.Tab_list_bus_stop.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    Context context = getActivity();
    DbOpenHelper dbOpenHelper = new DbOpenHelper(context);
    SQLiteDatabase db;//from w ww. j  a va2s.  co  m
    db = dbOpenHelper.getWritableDatabase();
    ContentValues cv = new ContentValues();
    cv.clear();
    String st;
    st = "";
    st = "SELECT bus_stop_table.Name FROM bus_stop_path_table INNER JOIN bus_stop_table ON  bus_stop_path_table.Bus_stop_id=bus_stop_table.id ";
    st = st + "INNER JOIN bus_path_table ON  bus_stop_path_table.Bus_path_id=bus_path_table.id ";
    st = st + " WHERE bus_stop_path_table.Bus_path_id='" + busPathId + "'";
    st = st + " AND bus_stop_path_table.Type_day_id='" + typeDay + "'";
    Cursor c = db.rawQuery(st, null);

    while (c.moveToNext()) {
        String st2 = "";
        st2 = c.getString(0);
        results.add(st2);
    }
    //  ??
    ListView lvMain = (ListView) getView().findViewById(R.id.listView1);
    lvMain.setDivider(null);//   ? ListView
    //?? ?
    String[] values = results.toArray(new String[results.size()]);

    // custom adapter ? listview
    //? ClickListener ? listview
    lvMain.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        // ?
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            //?  ?
            String busStop = (String) parent.getItemAtPosition(position);
            String busStopId = "";
            Context context = getActivity();
            DbOpenHelper dbOpenHelper = new DbOpenHelper(context);
            SQLiteDatabase db;
            db = dbOpenHelper.getWritableDatabase();
            ContentValues cv = new ContentValues();
            cv.clear();

            String st = "";
            st = "SELECT bus_stop_table.id FROM bus_stop_table ";
            st = st + " WHERE bus_stop_table.Name='" + busStop + "'";
            Cursor c = db.rawQuery(st, null);
            while (c.moveToNext()) {
                busStopId = c.getString(0);
            }
            Intent intent = new Intent(getActivity(), List_bus_time.class);
            intent.putExtra("busPathId", busPathId);
            intent.putExtra("busStopId", busStopId);
            intent.putExtra("typeDay", typeDay);
            //?  ? ?  
            startActivity(intent);
            //     
            // overridePendingTransition(R.anim.slide_left_in, R.anim.slide_left_out);**/
        }
    });
    ListviewArrayAdapter adapter = new ListviewArrayAdapter(getActivity(), values, values.length - 1);
    //     listview
    lvMain.setAdapter(adapter);
}

From source file:com.amaze.filemanager.fragments.AppsListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);//from  w  w  w  . j a  v a  2 s.c om
    MainActivity mainActivity = (MainActivity) getActivity();
    mainActivity.getAppbar().setTitle(R.string.apps);
    mainActivity.floatingActionButton.getMenuButton().hide();
    mainActivity.getAppbar().getBottomBar().setVisibility(View.GONE);
    mainActivity.supportInvalidateOptionsMenu();
    vl = getListView();
    Sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    getSortModes();
    ListView vl = getListView();
    vl.setDivider(null);
    if (utilsProvider.getAppTheme().equals(AppTheme.DARK))
        getActivity().getWindow().getDecorView()
                .setBackgroundColor(Utils.getColor(getContext(), R.color.holo_dark_background));
    else if (utilsProvider.getAppTheme().equals(AppTheme.BLACK))
        getActivity().getWindow().getDecorView()
                .setBackgroundColor(Utils.getColor(getContext(), android.R.color.black));

    modelProvider = new AppsAdapterPreloadModel(app);
    ViewPreloadSizeProvider<String> sizeProvider = new ViewPreloadSizeProvider<>();
    ListPreloader<String> preloader = new ListPreloader<>(GlideApp.with(app), modelProvider, sizeProvider,
            GlideConstants.MAX_PRELOAD_APPSADAPTER);

    adapter = new AppsAdapter(getContext(), (ThemedActivity) getActivity(), utilsProvider, modelProvider,
            sizeProvider, R.layout.rowlayout, app);

    getListView().setOnScrollListener(preloader);
    setListAdapter(adapter);
    setListShown(false);
    setEmptyText(getString(R.string.no_applications));
    getLoaderManager().initLoader(ID_LOADER_APP_LIST, null, this);

    if (savedInstanceState != null) {
        index = savedInstanceState.getInt(KEY_INDEX);
        top = savedInstanceState.getInt(KEY_TOP);
    }
}