Por lo tanto, me gustaría poder reconocer gestos avanzados usando GestureOverlayView y OnGestureListener, así como también poder detectar pulsaciones dobles y pulsaciones largas utilizando GestureDetector. Tengo ambas funciones trabajando bien por separado en dos proyectos diferentes. Sin embargo, estoy tratando de combinarlos y tengo algunos problemas. Parece que cuando intento presionar dos veces/presionar, no se reconoce porque GestureOverlayView cubre toda la pantalla y solo reconocerá los gestos avanzados definidos en Gesture Builder. ¿Alguien sabe cómo configurar GestureOverlayView para que permita a GestureDetector hacer su trabajo? Mi código:GestureOverlayView y Double-Tap
public class HelloAndroid extends Activity implements OnGesturePerformedListener, OnDoubleTapListener, OnGestureListener {
/** Called when the activity is first created. */
private GestureLibrary mLibrary;
private GestureDetector detector;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
if (!mLibrary.load()) {
finish();
}
GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);
detector = new GestureDetector(this, this);\
Y el xml ...
<?xml version="1.0" encoding="utf-8"?>
<android.gesture.GestureOverlayView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gestures"
android:layout_width="fill_parent"
android:visibility="invisible"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
</android.gesture.GestureOverlayView>
Gracias de antemano!
Esto realmente funcionó. Gracias ! –