Android gesture 原理,androidgesture

來源:互聯網
上載者:User

Android gesture 原理,androidgesture

1、簡介在Android中,我們通過工具GestureDetector識別手勢,識別手勢可提高我們的app使用者感知。
2、詳解

1、手碰事件


2、Touch事件機制



3、GestureDetector



總結

接觸手勢識別處理理想的開源項目應該是jamendo,想深入研究的朋友可以好好瞭解。


android GestureDetector構造器棄用

隨著Android SDK的升級,以前的某些介面可能有更好、更安全的介面來代替。AndroidTeam Dev會把過時的介面標識成deprecated, 然後在開發文檔中提示使用最新的代替介面。
你用到的GestureDetector的建構函式在4.1版本中已經過時,可以使用推薦的:
mGestureDetector = new GestureDetector(this, this);
// 注意前一個this代表的是一個Context,後一個this代表的是一個OnGestureListener。
// Activity繼承自Context, 而你的activity應該實現了(implements)OnGestureListener介面。
 
Android TouchEvent與GestureDetector是什關係?

Touch的一切的操作確實都能用onTouchEvnet()搞定, 不過GestureDetector是用來處理MotionEvent的, 需要先在onTouchEvent(MotionEvent event)中調用GestureDetector.onTouchEvnet(event).以下是官方文檔中關於GestureDetector這個類的用法:To use this class:
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.