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:com.klinker.android.twitter.settings.SettingsActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        onBackPressed();//from w  w  w  .  ja  va 2 s  .  c  o  m
        return true;
    case R.id.menu_whats_new:
        final Context context = this;
        final ListView list = new ListView(this);
        list.setDividerHeight(0);

        new AsyncTask<Spanned[], Void, Spanned[]>() {
            @Override
            public Spanned[] doInBackground(Spanned[]... params) {
                return XmlChangelogUtils.parse(context);
            }

            @Override
            public void onPostExecute(Spanned[] result) {
                list.setAdapter(new ChangelogAdapter(context, result));
            }
        }.execute();

        new AlertDialog.Builder(this).setTitle(R.string.changelog).setView(list)
                .setPositiveButton(R.string.ok, null).show();
        return true;
    case R.id.menu_rate_it:
        Uri uri = Uri.parse("market://details?id=" + getPackageName());
        Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);

        try {
            startActivity(goToMarket);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(this, "Couldn't launch the market", Toast.LENGTH_SHORT).show();
        }
        return true;
    case R.id.menu_get_help:
        showSettings(7, getString(R.string.get_help_settings));
        return true;
    case R.id.menu_other_apps:
        showSettings(8, getString(R.string.other_apps));
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

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);/* w  w  w . j  av  a 2s.  c  o  m*/
    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: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);

    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);// www  .j  ava  2  s.c om

    setListAdapter(adapter);

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

From source file:net.d53.syman.mobile.ui.TrafficListFragment.java

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

    listView.setFastScrollEnabled(true);
    listView.setDividerHeight(0);

    View graph = activity.getLayoutInflater().inflate(layout.traffic_graph, null);
    barGraph = (GaugeGraphView) graph.findViewById(id.gauge_graph);
    getListAdapter().addHeader(graph);//from  www  .j a v a  2s  .  c  om
    getListAdapter().addHeader(activity.getLayoutInflater().inflate(layout.traffic_list_item_labels, null));
}

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

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

    ListView listView = getListView();
    listView.setCacheColorHint(getResources().getColor(android.R.color.transparent));
    listView.setFastScrollEnabled(true);
    listView.setDividerHeight(0);

    if (getListAdapter() == null)
        listView.addHeaderView(//from   w  w w.  j av a 2s .  co m
                getActivity().getLayoutInflater().inflate(layout.referrer_list_item_labels, null), null, false);
}

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

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

    ListView listView = getListView();
    listView.setCacheColorHint(getResources().getColor(android.R.color.transparent));
    listView.setFastScrollEnabled(true);
    listView.setDividerHeight(0);

    if (getListAdapter() == null)
        listView.addHeaderView(getActivity().getLayoutInflater().inflate(layout.content_list_item_labels, null),
                null, false);/*from w ww  .  java 2s.  c  o  m*/
}

From source file:org.svij.taskwarriorapp.fragments.TaskListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setListView();/*  w ww  .j  av a2 s . c  o m*/

    ListView listview = getListView();
    listview.setDividerHeight(0);
    listview.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            selectedItemId = id + 1;
            adapter.changeTaskRow(position);
        }
    });
}

From source file:org.tanrabad.team.ChatFragment.java

private void turnOffListViewDecoration(ListView listView) {
    listView.setDivider(null);/*  w w  w .j  a v a 2  s . c  om*/
    listView.setDividerHeight(0);
    listView.setHorizontalFadingEdgeEnabled(false);
    listView.setVerticalFadingEdgeEnabled(false);
    listView.setHorizontalScrollBarEnabled(false);
    listView.setVerticalScrollBarEnabled(true);
    listView.setSelector(new ColorDrawable(0x00ffffff));
    listView.setCacheColorHint(0x00000000); // For Gingerbread scrolling bug fix
}

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);
    listView.setFastScrollEnabled(true);
}

From source file:net.ustyugov.jtalk.activity.XMLConsole.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    service = JTalkService.getInstance();
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);
    setTitle("XML Console");
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.paged_activity);

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

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

    Cursor cursor = service.getContentResolver().query(JTalkProvider.ACCOUNT_URI, null,
            AccountDbHelper.ENABLED + " = '" + 1 + "'", null, null);
    if (cursor != null && cursor.getCount() > 0) {
        cursor.moveToFirst();/*  w  w w .j  a v  a 2s .  c  o  m*/
        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);
        } 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);
}