`
Hawkes
  • 浏览: 74879 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

ViewConfiguration滑动参数设置类

阅读更多
/**
* 包含了方法和标准的常量用来设置UI的超时、大小和距离
*/
public class ViewConfiguration {
    // 设定水平滚动条的宽度和垂直滚动条的高度,单位是像素px
    private static final int SCROLL_BAR_SIZE = 10;

    //定义滚动条逐渐消失的时间,单位是毫秒
    private static final int SCROLL_BAR_FADE_DURATION = 250;

    // 默认的滚动条多少秒之后消失,单位是毫秒
    private static final int SCROLL_BAR_DEFAULT_DELAY = 300;

    // 定义边缘地方褪色的长度
    private static final int FADING_EDGE_LENGTH = 12;

    //定义子控件按下状态的持续事件
    private static final int PRESSED_STATE_DURATION = 125;
   
    //定义一个按下状态转变成长按状态的转变时间
    private static final int LONG_PRESS_TIMEOUT = 500;
   
    //定义用户在按住适当按钮,弹出全局的对话框的持续时间
    private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
   
    //定义一个touch事件中是点击事件还是一个滑动事件所需的时间,如果用户在这个时间之内滑动,那么就认为是一个点击事件
    private static final int TAP_TIMEOUT = 115;
   
    /**
     * Defines the duration in milliseconds we will wait to see if a touch event
     * is a jump tap. If the user does not complete the jump tap within this interval, it is
     * considered to be a tap.
     */
    //定义一个touch事件时候是一个点击事件。如果用户在这个时间内没有完成这个点击,那么就认为是一个点击事件
    private static final int JUMP_TAP_TIMEOUT = 500;

    //定义双击事件的间隔时间
    private static final int DOUBLE_TAP_TIMEOUT = 300;
   
    //定义一个缩放控制反馈到用户界面的时间
    private static final int ZOOM_CONTROLS_TIMEOUT = 3000;

    /**
     * Inset in pixels to look for touchable content when the user touches the edge of the screen
     */
    private static final int EDGE_SLOP = 12;
   
    /**
     * Distance a touch can wander before we think the user is scrolling in pixels
     */
    private static final int TOUCH_SLOP = 16;
   
    /**
     * Distance a touch can wander before we think the user is attempting a paged scroll
     * (in dips)
     */
    private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
   
    /**
     * Distance between the first touch and second touch to still be considered a double tap
     */
    private static final int DOUBLE_TAP_SLOP = 100;
   
    /**
     * Distance a touch needs to be outside of a window's bounds for it to
     * count as outside for purposes of dismissing the window.
     */
    private static final int WINDOW_TOUCH_SLOP = 16;

   //用来初始化fling的最小速度,单位是每秒多少像素
    private static final int MINIMUM_FLING_VELOCITY = 50;
   
    //用来初始化fling的最大速度,单位是每秒多少像素
    private static final int MAXIMUM_FLING_VELOCITY = 4000;

    //视图绘图缓存的最大尺寸,以字节表示。在ARGB888格式下,这个尺寸应至少等于屏幕的大小
    @Deprecated
    private static final int MAXIMUM_DRAWING_CACHE_SIZE = 320 * 480 * 4; // HVGA screen, ARGB8888

    //flings和scrolls摩擦力度大小的系数
    private static float SCROLL_FRICTION = 0.015f;

    /**
     * Max distance to over scroll for edge effects
     */
    private static final int OVERSCROLL_DISTANCE = 0;

    /**
     * Max distance to over fling for edge effects
     */
    private static final int OVERFLING_DISTANCE = 4;

}
分享到:
评论

相关推荐

    安卓高级UI培训课程

    自绘控件、继承控件、组合控件、Scroller详解及源码浅析、ViewDragHelper详解及源码浅析、自定义View触摸工具类解析(ViewConfiguration基础参数工具类、VelocityTracker手势速率工具类、GestureDetector手势工具类...

    Android 中实现ListView滑动隐藏标题栏的代码

    int mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop(); //滑动监听 showHideTitleBar(true); ListView standby_lv = (ListView) findViewById(R.id.standby_lv); standby_lv.setOnTouchListener...

    左右滑动控件

    mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); WindowManager windowManager = ((Activity) context).getWindow() .getWindowManager(); Display display = windowManager....

    Google play效果 listViewGridView下拉刷新上拉加载更多,图片加载OOm问题

    touchSlop = ViewConfiguration.get(ViewPagerListViewActivity.this).getScaledTouchSlop(); pager.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, ...

    Android实现标题显示隐藏功能

    本文实例尝试模仿实现Android标题显示隐藏功能,通过给listview设置 mListView.setOnTouchListener 监听 重写ontouch方法 监听手指一动的坐标,当超过ViewConfiguration.get(this).getScaledTouchSlop(); toubar的...

    Action Bar初识案例

    解决办法:通过在onCreate()中try {ViewConfiguration mconfig = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if(menuKeyField != null...

    javastarter:BridgePhase Java Web 应用程序入门项目

    Java 入门项目 这将创建一个 Gradle 构建驱动的 Java 项目,以快速创建新的 ... 更新ViewConfiguration下的basePackages以匹配您的应用程序的实际包 更新/src/main/resources/public下的modules ,这些是驱动前端的项目

    APExtensions:有用的扩展,控制器和协议集合

    要安装它,只需将以下行添加到您的Podfile中: pod 'APExtensions' , '~> 9.0'可用子规格: Core , Storyboard , ViewConfiguration 。子规范的示例Podfile: pod 'APExtensions/Core' , '~> 9.0'pod '...

    Android NavigationBar问题处理的方法

    如图,现在全面屏手机下面的 按钮在屏幕上,如果做沉浸式的话,下面的菜单会沉入NavigationBar下方,造成重叠。 样品机为华为.png ... boolean hasMenuKey = ViewConfiguration.get(this).hasPermanentMenuKe

    Android酷炫转动菜单

    import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.zhy.ccbCricleMenu.R; ...

    ViewPager 放大缩小左右移动

    实现 图片的放大,缩小,左右屏幕滑动 。 直接贴代码吧。。 public class ViewPager extends ViewGroup { private static final String TAG = "ViewPager"; private static final boolean DEBUG = false; ...

Global site tag (gtag.js) - Google Analytics