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:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.Motion.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent i = this.getIntent();
    Bundle b = i.getExtras();// ww w.  j  ava2  s. c  o  m

    //top panel setting
    motion_organization_position = b.getInt(Orgs.O_ID);
    motion_organization_lid = b.getString(Orgs.O_LID);
    motion_organization_gidh = b.getString(Orgs.O_GIDH);
    motion_enhanced_lid = b.getString(Motion.M_MOTION_ENHANCED);

    activ = this;
    reloadMotions();
    actionbar = this.getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);

    //motionTitle = new MotionItem[] { "Should we...", "Should USA..."
    //};

    listAdapter = new MotionAdapter(this, R.layout.motion_list, motionTitle);
    setListAdapter(listAdapter);

    ListView listview = getListView();
    listview.setDivider(null);
}

From source file:com.btmura.android.reddit.app.CommentListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = super.onCreateView(inflater, container, savedInstanceState);
    ListView lv = (ListView) v.findViewById(android.R.id.list);
    lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    lv.setMultiChoiceModeListener(this);
    lv.setDivider(null);
    return v;/*  w w  w  . j av a2s  .  c  o  m*/
}

From source file:com.app4am.app4am.LatestNewsListFragment.java

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

    if (savedInstanceState != null) {
        mPosition = savedInstanceState.getInt(SwipeRefreshFragmentInterface.FRAGMENT_POSITION);
    }/*from ww  w.  j a v  a2s  .c  o  m*/

    // Change the colors displayed by the SwipeRefreshLayout by providing it with 4
    // color resource ids
    setColorSchemeResources(R.color.color_scheme_1_1, R.color.color_scheme_1_2, R.color.color_scheme_1_3,
            R.color.color_scheme_1_4);

    // Set list view background color.
    view.setBackgroundResource(R.color.color_common_list_background);

    // List item divider and background color
    ListView listView = getListView();
    listView.setDivider(getResources().getDrawable(R.drawable.common_list_divider));
    listView.setDividerHeight((int) getResources().getDimension(R.dimen.common_list_divider_height));
    listView.setBackgroundResource(R.color.color_common_list_background);
    listView.setCacheColorHint(0);

    // List selector
    listView.setSelector(R.drawable.list_view_selector);
    listView.setDrawSelectorOnTop(true);

    // Event handler
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO: Open topic information page (B01) ?!
            Log.d(LOG_TAG, "on click");
        }
    });

    listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO: Open topic introduction page (B02) ?!
            Log.d(LOG_TAG, "on long click");

            return false;
        }
    });

    /**
     * Create an ArrayAdapter to contain the data for the ListView. Each item in the ListView
     * uses the system-defined simple_list_item_1 layout that contains one TextView.
     */
    ListAdapter adapter = new ArrayAdapter<String>(getActivity(), R.layout.latest_news_list_item, R.id.textView,
            Cheeses.randomList(LIST_ITEM_COUNT));

    // Set the adapter between the ListView and its backing data.
    setListAdapter(adapter);

    // BEGIN_INCLUDE (setup_refreshlistener)
    /**
     * Implement {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener}. When users do the "swipe to
     * refresh" gesture, SwipeRefreshLayout invokes
     * {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()}. In
     * {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()}, call a method that
     * refreshes the content. Call the same method in response to the Refresh action from the
     * action bar.
     */
    setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            Log.i(LOG_TAG, "onRefresh called from SwipeRefreshLayout");

            initiateRefresh();
        }
    });
    // END_INCLUDE (setup_refreshlistener)

}

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

/**
 * fills the listview with the timetable
 * @return a cursor to the time table/*from   w  w w.  ja  va  2  s  .  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//  ww w  .  ja  va2  s.co  m
 */
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:com.tct.email.activity.setup.EmailPreferenceActivity.java

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

    final Intent i = getIntent();
    if (savedInstanceState == null) {
        // If we are not restarting from a previous instance, we need to
        // figure out the initial prefs to show.  (Otherwise, we want to
        // continue showing whatever the user last selected.)
        if (INTENT_ACCOUNT_MANAGER_ENTRY == null) {
            INTENT_ACCOUNT_MANAGER_ENTRY = getString(R.string.intent_account_manager_entry);
        }//from   w ww .  j av  a  2s  . c om
        if (INTENT_ACCOUNT_MANAGER_ENTRY.equals(i.getAction())) {
            // This case occurs if we're changing account settings from Settings -> Accounts.
            // We get an account object in the intent, but it's not actually useful to us since
            // it's always just the first account of that type. The user can't specify which
            // account they wish to view from within the settings UI, so just dump them at the
            // main screen.
            // android.accounts.Account acct = i.getParcelableExtra("account");
        } else if (i.hasExtra(EditSettingsExtras.EXTRA_FOLDER)) {
            throw new IllegalArgumentException("EXTRA_FOLDER is no longer supported");
        } else {
            // Otherwise, we're called from within the Email app and look for our extras
            final long accountId = IntentUtilities.getAccountIdFromIntent(i);
            if (accountId != -1) {
                final Bundle args = AccountSettingsFragment.buildArguments(accountId);
                startPreferencePanel(AccountSettingsFragment.class.getName(), args, 0, null, null, 0);
                // TS: jin.dong 2015-08-07 EMAIL BUGFIX_989528 ADD_S
                finish();
                return;
                // TS: jin.dong 2015-08-07 EMAIL BUGFIX_989528 ADD_E
            }
        }
    }
    mShowDebugMenu = i.getBooleanExtra(EXTRA_ENABLE_DEBUG, false);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
    }
    ListView listView = getListView();
    if (listView != null) {
        listView.setDivider(new ColorDrawable(Color.GRAY));
        listView.setDividerHeight(1);
    }
    mFeedbackUri = Utils.getValidUri(getString(R.string.email_feedback_uri));
}

From source file:qr.cloud.qrpedia.MyTagsListFragment.java

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

    // configure the list view
    ListView listView = getListView();
    QRCloudUtils.setListViewEmptyView(listView, getString(R.string.no_posted_messages), R.string.default_font,
            R.dimen.activity_horizontal_margin, R.dimen.activity_vertical_margin);
    listView.setSelector(R.drawable.message_row_selector); // override the default selector
    listView.setDivider(new ColorDrawable(this.getResources().getColor(R.color.list_divider)));
    listView.setDividerHeight(1);// w w  w .  j  a v a  2 s . c  o m
    if (mIsInDialog && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // fix black background issue pre-honeycomb
        listView.setBackgroundColor(Color.WHITE);
    }
}

From source file:eu.trentorise.smartcampus.jp.MyItinerariesFragment.java

@Override
public void onStart() {
    super.onStart();
    TextView noitems = (TextView) getView().findViewById(R.id.myitinearies_noitems_label);
    //      if ((myItineraries==null)||(myItineraries.size()==0))
    //         {/*from w  w w .j  a  va 2 s  . c  o m*/
    //         //put "empty string"
    //         noitems.setVisibility(View.VISIBLE);
    //         }
    //      else {
    noitems.setVisibility(View.GONE);
    //      }
    ListView myJourneysList = (ListView) getView().findViewById(R.id.myitineraries_list);
    adapter = new MyItinerariesListAdapter(getSherlockActivity(), R.layout.itinerarychoicessaved_row,
            myItineraries);
    myJourneysList.setAdapter(adapter);
    myJourneysList.setDivider(null);
    myJourneysList.setDividerHeight(Utils.convertDpToPixel(6, getActivity()));

    SCAsyncTask<Void, Void, List<BasicItinerary>> task = new SCAsyncTask<Void, Void, List<BasicItinerary>>(
            getSherlockActivity(), new GetMyItinerariesProcessor(getSherlockActivity(), adapter));
    task.execute();

    myJourneysList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            FragmentTransaction fragmentTransaction = getSherlockActivity().getSupportFragmentManager()
                    .beginTransaction();
            Fragment fragment = MyItineraryFragment.newInstance(adapter.getItem(position));
            fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
            fragmentTransaction.replace(Config.mainlayout, fragment, Config.MY_JOURNEYS_FRAGMENT_TAG);
            fragmentTransaction.addToBackStack(fragment.getTag());
            fragmentTransaction.commit();
        }
    });
    //hide keyboard if it is still open
    InputMethodManager imm = (InputMethodManager) getSherlockActivity()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(getSherlockActivity().getWindow().getDecorView()
            .findViewById(android.R.id.content).getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
}

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

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);//w  w w  . j a  v a  2  s  .com
    mainActivity = (MainActivity) getActivity();
    mainActivity.setActionBarTitle(utils.getString(getActivity(), R.string.apps));
    mainActivity.floatingActionButton.hideMenuButton(true);
    mainActivity.buttonBarFrame.setVisibility(View.GONE);
    mainActivity.supportInvalidateOptionsMenu();
    fabSkin = mainActivity.fabskin;
    vl = getListView();
    Sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    getSortModes();
    ListView vl = getListView();
    int theme = Integer.parseInt(Sp.getString("theme", "0"));
    theme1 = theme == 2 ? PreferenceUtils.hourOfDay() : theme;
    vl.setDivider(null);
    if (theme1 == 1)
        getActivity().getWindow().getDecorView()
                .setBackgroundColor(getResources().getColor(R.color.holo_dark_background));
    if (savedInstanceState == null)
        loadlist(false);
    else {
        c = savedInstanceState.getParcelableArrayList("c");
        a = savedInstanceState.getParcelableArrayList("list");
        adapter = new AppsAdapter(getActivity(), R.layout.rowlayout, a, app, c);
        setListAdapter(adapter);
        vl.setSelectionFromTop(savedInstanceState.getInt("index"), savedInstanceState.getInt("top"));

    }
}

From source file:qr.cloud.qrpedia.BookmarksListFragment.java

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

    // configure the list view
    ListView listView = getListView();
    QRCloudUtils.setListViewEmptyView(listView, getString(R.string.no_bookmarks), R.string.default_font,
            R.dimen.activity_horizontal_margin, R.dimen.activity_vertical_margin);
    listView.setSelector(R.drawable.message_row_selector); // override the default selector
    listView.setDivider(new ColorDrawable(this.getResources().getColor(R.color.list_divider)));
    listView.setDividerHeight(1);/*from   ww  w  .  ja v a  2s.  com*/
    if (mIsInDialog && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // fix black background issue pre-honeycomb
        listView.setBackgroundColor(Color.WHITE);
    }
}