Example usage for android.widget ListView setDividerHeight

List of usage examples for android.widget ListView setDividerHeight

Introduction

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

Prototype

public void setDividerHeight(int height) 

Source Link

Document

Sets the height of the divider that will be drawn between each item in the list.

Usage

From source file:org.level28.android.moca.ui.banners.BannerFragment.java

@Override
protected void configureList(Activity activity, ListView listView) {
    super.configureList(activity, listView);

    if (activity.getResources().getBoolean(R.bool.dualPaned)) {
        // Don't show dividers in dual-pane mode, they're really ugly
        listView.setDividerHeight(0);
    }//from www.j  a v  a  2 s .co m
}

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);

    mAdapter = new TabTransactionAdapter(mContext);

    setListAdapter(mAdapter);//from  w  ww. ja  v a  2  s  .c o m

    setListShown(false);
}

From source file:in.yangxu.navigationdrawer.view.SuperAwesomeCardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.homelistviewlayout, container, false);
    final SwipeRefreshLayout mSwipeRefreshLayout = (SwipeRefreshLayout) v
            .findViewById(R.id.activity_main_swipe_refresh_layout);

    if (position == 0) {
        mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override/* w  w w  .  j  a va 2 s.  c  o m*/
            public void onRefresh() {
                mSwipeRefreshLayout.setRefreshing(false);

            }
        });
        ListView listView = (ListView) v.findViewById(R.id.activity_main_listview);
        listView.setCacheColorHint(Color.TRANSPARENT);
        listView.setDividerHeight(0);

        Item item1 = new Item();
        Item item2 = new Item();
        Item item3 = new Item();
        list.add(item1);
        list.add(item2);
        list.add(item3);
        adapter = new ItemAdapter(list, getActivity());
        listView.setAdapter(adapter);

        listView.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
                if (lastVisibleItem == totalItemCount1 && scrollState == SCROLL_STATE_IDLE) {

                    Item item4 = new Item();
                    list.add(item4);

                    adapter.notifyDataSetChanged();
                }
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                    int totalItemCount) {
                lastVisibleItem = firstVisibleItem + visibleItemCount;
                totalItemCount1 = totalItemCount;
            }
        });
    } else {
        mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                mSwipeRefreshLayout.setRefreshing(false);

            }
        });
        ListView listView = (ListView) v.findViewById(R.id.activity_main_listview);
        listView.setCacheColorHint(Color.TRANSPARENT);
        listView.setDividerHeight(0);

        Item item1 = new Item();
        list.add(item1);
        adapter = new ItemAdapter(list, getActivity());
        listView.setAdapter(adapter);

        listView.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
                if (lastVisibleItem == totalItemCount1 && scrollState == SCROLL_STATE_IDLE) {

                    Item item4 = new Item();
                    list.add(item4);

                    adapter.notifyDataSetChanged();
                }
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                    int totalItemCount) {
                lastVisibleItem = firstVisibleItem + visibleItemCount;
                totalItemCount1 = totalItemCount;
            }
        });
    }

    return v;
}

From source file:com.github.mobile.ui.repo.RepositoryListFragment.java

@Override
protected void configureList(Activity activity, ListView listView) {
    super.configureList(activity, listView);

    listView.setDividerHeight(0);
    updateHeaders(items);//from   w  w w.  j  av  a2  s.  c om
}

From source file:io.indy.drone.fragment.StrikeListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ListView lv = getListView();
    lv.setDivider(null);//from  w  w  w . j a v  a2 s .  c  o m
    lv.setDividerHeight(0);

    // Restore the previously serialized activated item position.
    if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
        setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
    }

    // This is the View which is created by ListFragment
    ViewGroup viewGroup = (ViewGroup) view;

    // We need to create a PullToRefreshLayout manually
    mPullToRefreshLayout = new PullToRefreshLayout(viewGroup.getContext());

    // We can now setup the PullToRefreshLayout
    ActionBarPullToRefresh.from(getActivity())

            // We need to insert the PullToRefreshLayout into the Fragment's ViewGroup
            .insertLayoutInto(viewGroup)

            // We need to mark the ListView and it's Empty View as pullable
            // This is because they are not direct children of the ViewGroup
            .theseChildrenArePullable(getListView(), getListView().getEmptyView())

            // We can now complete the setup as desired
            .listener(new OnRefreshListener() {
                @Override
                public void onRefreshStarted(View view) {
                    Intent intent = new Intent(getActivity(), ScheduledService.class);
                    intent.putExtra(StrikeListActivity.ResponseReceiver.IS_PTR, true);
                    getActivity().startService(intent);
                }
            }).setup(mPullToRefreshLayout);
}

From source file:it.sasabz.android.sasabus.fragments.OrarioFragment.java

/**
 * fills the listview with the timetable
 * @return a cursor to the time table/*  w  w w  . jav a 2s. c  o m*/
 */
private void fillData(View result) {
    list = PassaggioList.getVector(linea.getId(), arrival.getName_de(), departure.getName_de(),
            bacino.getTable_prefix());
    pos = getNextTimePosition(list);
    MyPassaggioListAdapter orari = new MyPassaggioListAdapter(SASAbus.getContext(), R.id.text,
            R.layout.standard_row, list, pos);
    ListView listview = (ListView) result.findViewById(android.R.id.list);
    listview.setAdapter(orari);
    listview.setOnItemClickListener(this);
    listview.setDividerHeight(0);
    listview.setDivider(null);
}

From source file:it.sasabz.android.sasabus.fragments.WayFragment.java

/**
 * fills the listview with the timetable
 * @return a cursor to the time table//w  w w  .  j  av  a2 s.  c om
 */
private void fillData(View result) {
    list = PassaggioList.getVectorWay(orario.getId(), arrival.getName_de(), bacino.getTable_prefix());
    if (list == null) {
        createErrorDialog();
        return;
    }
    pos = getNextTimePosition(list);
    MyWayListAdapter way = new MyWayListAdapter(getActivity(), list, pos);
    ListView listview = (ListView) result.findViewById(android.R.id.list);
    listview.setAdapter(way);
    listview.setDividerHeight(0);
    listview.setDivider(null);
}

From source file:net.ustyugov.jtalk.activity.muc.Muc.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    service = JTalkService.getInstance();
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);
    setTitle(R.string.MUC);/*from   ww  w  .j  ava2s.  c  o  m*/
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.paged_activity);

    LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
    linear.setBackgroundColor(Colors.BACKGROUND);

    MainPageAdapter adapter = new MainPageAdapter(mPages);
    LayoutInflater inflater = LayoutInflater.from(this);

    Cursor cursor = service.getContentResolver().query(JTalkProvider.ACCOUNT_URI, null,
            AccountDbHelper.ENABLED + " = '" + 1 + "'", null, null);
    if (cursor != null && cursor.getCount() > 0) {
        cursor.moveToFirst();
        do {
            final String account = cursor.getString(cursor.getColumnIndex(AccountDbHelper.JID)).trim();

            View page = inflater.inflate(R.layout.list_activity, null);
            page.setTag(account);
            mPages.add(page);

            ListView list = (ListView) page.findViewById(R.id.list);
            list.setDividerHeight(0);
            list.setCacheColorHint(0x00000000);
            list.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                    RosterItem item = (RosterItem) parent.getItemAtPosition(position);
                    String name = item.getName();
                    String account = item.getAccount();

                    if (item.isGroup()) {
                        if (item.isCollapsed()) {
                            while (service.getCollapsedGroups().contains(name))
                                service.getCollapsedGroups().remove(name);
                            item.setCollapsed(false);
                        } else {
                            service.getCollapsedGroups().add(name);
                            item.setCollapsed(true);
                        }
                        updateList();
                    } else if (item.isEntry()) {
                        RosterEntry re = item.getEntry();
                        String jid = re.getUser();
                        Intent i = new Intent(Muc.this, Chat.class);
                        i.putExtra("account", account);
                        i.putExtra("jid", jid);
                        startActivity(i);
                    } else if (item.isMuc()) {
                        Intent i = new Intent(Muc.this, Chat.class);
                        i.putExtra("account", account);
                        i.putExtra("jid", item.getName());
                        startActivity(i);
                    }
                }
            });

            list.setOnItemLongClickListener(new OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
                    RosterItem item = (RosterItem) parent.getItemAtPosition(position);
                    if (item.isGroup()) {
                        //
                    } else if (item.isEntry()) {
                        String j = item.getEntry().getUser();
                        String group = StringUtils.parseBareAddress(j);
                        String nick = StringUtils.parseResource(j);
                        MucDialogs.userMenu(Muc.this, item.getAccount(), group, nick);
                    } else if (item.isMuc()) {
                        MucDialogs.roomMenu(Muc.this, item.getAccount(), item.getName());
                    }
                    return true;
                }
            });

            MucRosterAdapter mra = new MucRosterAdapter(this, account);
            list.setAdapter(mra);
            adapters.add(mra);

        } while (cursor.moveToNext());
        cursor.close();
    }

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(adapter);
    mPager.setCurrentItem(0);

    TitlePageIndicator mTitleIndicator = (TitlePageIndicator) findViewById(R.id.indicator);
    mTitleIndicator.setTextColor(0xFF555555);
    mTitleIndicator.setViewPager(mPager);
}

From source file:jahirfiquitiva.iconshowcase.fragments.base.PreferenceFragment.java

@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle savedInstanceState) {
    ListView listView = new ListView(getActivity());
    listView.setId(android.R.id.list);//from  www  . java2s. c  om
    listView.setDividerHeight(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            HC_HORIZONTAL_PADDING = 5.33;
        }
        final int horizontalPadding = (int) (HC_HORIZONTAL_PADDING
                * getResources().getDisplayMetrics().density);
        listView.setPadding(horizontalPadding, 0, horizontalPadding, 0);
    }
    return listView;
}

From source file:com.brookmanholmes.bma.wizard.ui.ReviewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    wizardModel = callbacks.onGetModel();
    wizardModel.registerListener(this);
    onPageTreeChanged();//www  .j a  v a2 s. c  om

    View rootView = inflater.inflate(R.layout.fragment_page, container, false);

    TextView titleView = (TextView) rootView.findViewById(android.R.id.title);
    titleView.setText(R.string.title_review);
    titleView.setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));

    ListView listView = (ListView) rootView.findViewById(android.R.id.list);
    setListAdapter(reviewAdapter);
    listView.setDividerHeight(0);
    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    return rootView;
}