码迷,mamicode.com
首页 > 移动开发 > 详细

android UI效果相关-ListView(一)

时间:2015-01-08 15:49:03      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

方法一 通过反射:

代码:

        Class clsClass = listView.getClass().getSuperclass();
        if(clsClass == null){
            Log.d("tag", "null");
        }else {
            Log.d("tag", "not null");
            if(clsClass == AbsListView.class){
                Log.d("tag", "AbsListView");
                try {
                    Field minField = AbsListView.class.getDeclaredField("mMinimumVelocity");
                    Field maxField = AbsListView.class.getDeclaredField("mMaximumVelocity");
                    minField.setAccessible(true);
                    maxField.setAccessible(true);
                    try {
                        Log.d("tag", "min:" + minField.get(listView));
                        Log.d("tag", "max:" + maxField.get(listView));
                        maxField.set(listView, 2000);
                    } catch (IllegalArgumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    } catch (IllegalAccessException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                } catch (NoSuchFieldException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }else {
                Log.d("tag", "not AbsListView");
            }
        }

        mMinimumVelocity是滑动最小速度,
        mMaximumVelocity是滑动的最大速度

 

android UI效果相关-ListView(一)

标签:

原文地址:http://my.oschina.net/u/2250759/blog/365040

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!