真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

android手勢

一丶首先創(chuàng)建一個手勢庫

公司主營業(yè)務(wù):網(wǎng)站建設(shè)、做網(wǎng)站、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)公司是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)公司推出英吉沙免費做網(wǎng)站回饋大家。

二丶手勢實例

  1. 布局文件:

    在布局文件中有:

            android:id="@+id/gv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#000000"
            android:gestureStrokeWidth="10"
            android:gestureColor="#ff0000"
            />

  2. MainActivity中

    public class MainActivity extends Activity {
        
        private GestureOverlayView gv;//手勢控件
        private GestureLibrary gestureLibrary;//加載手勢庫
        private boolean loadStatus;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            //拿到控件
            gv = (GestureOverlayView) findViewById(R.id.gv);
           //創(chuàng)建加載手勢庫的工具
            gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
            //加載手勢庫
            loadStatus = gestureLibrary.load();
            //給gv加一個監(jiān)聽器
            //監(jiān)聽一種手勢
            gv.addOnGesturePerformedListener(new OnGesturePerformedListener() {
                
                @Override
                public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
                    //手勢加載成功
                    if(loadStatus){
                        //識別手勢 Prediction(手勢相似度)
                        ArrayList pres = gestureLibrary.recognize(gesture);
                        if(!pres.isEmpty()){
                            Prediction pre = pres.get(0);
                            if(pre.score > 6){
                                if("close".equals(pre.name)){
                                    finish();
                                }else if("tel".equals(pre.name)){
                                    //打電話
                                    Intent intent  = new Intent();
                                    intent.setAction(Intent.ACTION_CALL);
                                    intent.setData(Uri.parse("tel://110"));
                                    startActivity(intent);
                                }else if("right".equals(pre.name)){
                                    Toast.makeText(getApplicationContext(), "正確", 0).show();
                                }
                            }else{
                                Toast.makeText(getApplicationContext(), "手勢不匹配", 0).show();
                            }
                        }else{
                            Toast.makeText(MainActivity.this, "手勢庫加載失敗", 0).show() ;
                        }
                        
                    }
                }
            });
        }
    }


網(wǎng)站名稱:android手勢
路徑分享:http://weahome.cn/article/poesio.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部