android.support.v4.widget.ListViewAutoScrollHelper Java Examples

The following examples show how to use android.support.v4.widget.ListViewAutoScrollHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListViewActivity.java    From Rocko-Android-Demos with Apache License 2.0 6 votes vote down vote up
private void init() {
        listView = (ListView) findViewById(R.id.list_view);

        String[] strs = getData(100);
        List<Map<String, Object>> list = new ArrayList<>();
        for (String str : strs) {
            Map<String, Object> map = new HashMap<>();
            map.put("text", str);
            list.add(map);
        }
        SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.item_simple, new String[]{"text"}, new int[]{R.id.text_view});
        listView.setAdapter(adapter);

        AutoScrollHelper autoScrollHelper = new ListViewAutoScrollHelper(listView);
        listView.setOnTouchListener(autoScrollHelper);
        autoScrollHelper.setEnabled(true);
//        autoScrollHelper.setActivationDelay(3000);
//        autoScrollHelper.setRampDownDuration(3000);
        Toast.makeText(this, "长按上或下边缘", Toast.LENGTH_SHORT).show();
    }