android - How to disable gesture highlight animation on onGesturePerformed? -
i doing similar gesture detection vogella tutorial here.
my mainactivity is:
package com.example.gesturesaveopendocs; import java.util.arraylist; import android.app.activity; import android.gesture.gesture; import android.gesture.gesturelibraries; import android.gesture.gesturelibrary; import android.gesture.gestureoverlayview; import android.gesture.gestureoverlayview.ongestureperformedlistener; import android.gesture.prediction; import android.os.bundle; import android.view.menu; import android.widget.toast; public class mainactivity extends activity implements ongestureperformedlistener { gesturelibrary gesture_library; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); gesture_library = gesturelibraries .fromrawresource(this, r.raw.gestures); if (!gesture_library.load()) { finish(); } gestureoverlayview gestures = (gestureoverlayview) findviewbyid(r.id.gestures); gestures.addongestureperformedlistener(this); } public void ongestureperformed(gestureoverlayview overlay, gesture gesture) { arraylist<prediction> predictions = gesture_library.recognize(gesture); if (predictions.size() > 0 && predictions.get(0).score > 1.0) { string result = predictions.get(0).name; if ("open".equalsignorecase(result)) { toast.maketext(this, "opening document", toast.length_long) .show(); } else if ("save".equalsignorecase(result)) { toast.maketext(this, "saving document", toast.length_long) .show(); } } } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } }
i disable highlight replication (yellow animation) finger gestures on screen. since need gesture functionality in app without highlight animation showing everytime swipe.
any appreciated. thanks!
you can turn off, via setgesturecolor(color.transparent) or setuncertaingesturecolor(color.transparent) on gestureoverlayview.
Comments
Post a Comment