android.support.v4.widget.ListViewAutoScrollHelper源码实例Demo

类android.support.v4.widget.ListViewAutoScrollHelper源码实例Demo

下面列出了android.support.v4.widget.ListViewAutoScrollHelper 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Rocko-Android-Demos   文件: ListViewActivity.java
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();
    }