Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> android中ViewConfiguration的簡單介紹

android中ViewConfiguration的簡單介紹

編輯:關於Android編程


android.view.ViewConfiguration Contains methods to standard constants used in the UI for timeouts, sizes, and distances.

常用方法:

ViewConfiguration.get(getContext()).getScaledTouchSlop()

官方描述:Distance in pixels a touch can wander before we think the user is scrolling

在被判定為滾動之前用戶手指可以移動的最大值。


除此之外,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;  
  
}  


參考:http://blog.csdn.net/lonelyroamer/article/details/7568129




  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved