Example usage for android.widget ListView setSmoothScrollbarEnabled

List of usage examples for android.widget ListView setSmoothScrollbarEnabled

Introduction

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

Prototype

public void setSmoothScrollbarEnabled(boolean enabled) 

Source Link

Document

When smooth scrollbar is enabled, the position and size of the scrollbar thumb is computed based on the number of visible pixels in the visible items.

Usage

From source file:org.quantumbadger.redreader.activities.InboxListingActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);
    super.onCreate(savedInstanceState);

    final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences)
            && PrefsUtility.appearance_theme(this, sharedPreferences) == PrefsUtility.AppearanceTheme.NIGHT;

    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    final String title;

    isModmail = getIntent() != null && getIntent().getBooleanExtra("modmail", false);

    if (!isModmail) {
        title = getString(R.string.mainmenu_inbox);
    } else {/*from ww  w . j  av a  2  s  . co  m*/
        title = getString(R.string.mainmenu_modmail);
    }

    OptionsMenuUtility.fixActionBar(this, title);

    headerItems = PrefsUtility.appearance_comment_header_items(this, sharedPreferences);
    headerItems.remove(PrefsUtility.AppearanceCommentHeaderItems.SCORE);

    final LinearLayout outer = new LinearLayout(this);
    outer.setOrientation(android.widget.LinearLayout.VERTICAL);

    if (solidblack) {
        outer.setBackgroundColor(Color.BLACK);
    }

    loadingView = new LoadingView(this, getString(R.string.download_waiting), true, true);

    notifications = new LinearLayout(this);
    notifications.setOrientation(android.widget.LinearLayout.VERTICAL);
    notifications.addView(loadingView);

    final ListView lv = new ListView(this);

    lv.setSmoothScrollbarEnabled(false);
    lv.setVerticalFadingEdgeEnabled(false);

    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            final Object item = lv.getAdapter().getItem(position);

            if (item != null && item instanceof RedditPreparedInboxItem) {
                ((RedditPreparedInboxItem) item).handleInboxClick(InboxListingActivity.this);
            }
        }
    });

    adapter = new InboxListingAdapter(this, this);
    lv.setAdapter(adapter);

    registerForContextMenu(lv);

    outer.addView(notifications);
    outer.addView(lv);

    makeFirstRequest(this);

    setContentView(outer);
}

From source file:mp.paschalis.ChooseLibraryFragment.java

/**
 * Get the selected Library//from   w w w .  j  a v a 2 s  .  c  om
 */
@Override
public void onListItemClick(ListView listView, View v, int position, long id) {

    // Save the library
    chosenLib = (Library) listView.getItemAtPosition(position);

    app.librarySelectedOnList = position;

    chosenLib.positionOnList = position;

    // Notify the parent activity of selected item
    mCallback.onLibrarySelected(chosenLib);

    // Set the item as checked to be highlighted when in two-pane layout
    listView.setItemChecked(position, true);

    listView.setSmoothScrollbarEnabled(true);
}

From source file:com.googlecode.networklog.LogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    MyLog.d("[LogFragment] onCreateView");
    LinearLayout layout = new LinearLayout(getActivity().getApplicationContext());
    layout.setOrientation(LinearLayout.VERTICAL);
    ListView listView = new ListView(getActivity().getApplicationContext());
    listView.setAdapter(adapter);/*from   ww w .  j  ava  2 s  .c o m*/
    listView.setTextFilterEnabled(true);
    listView.setFastScrollEnabled(true);
    listView.setSmoothScrollbarEnabled(false);
    listView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
    listView.setStackFromBottom(true);
    listView.setOnItemClickListener(new CustomOnItemClickListener());
    layout.addView(listView);
    registerForContextMenu(listView);
    startUpdater();
    return layout;
}