如何在相同的手势叠加中绘制多色手势

时间:2014-07-01 06:43:49

标签: android gesture

我正在开发一个绘图应用程序,并且我正在使用android的手势。因此,如果我想在运行时更改手势颜色,我已经绘制的旧手势也采用新颜色。任何相同的解决方案?

以下是我在xml中的手势

    <android.gesture.GestureOverlayView
    android:id="@+id/gestures_overlay1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:eventsInterceptionEnabled="true"
    android:fadeEnabled="false"
    android:fadeOffset="5000000000"
    android:gestureStrokeAngleThreshold="0"
    android:gestureStrokeLengthThreshold="0"
    android:gestureStrokeSquarenessThreshold="0"
    android:gestureStrokeType="multiple"
    android:gestureStrokeWidth="2"
    android:orientation="vertical" />

我在java调用中的手势就像

    overlay = (GestureOverlayView) findViewById(R.id.gestures_overlay1);
    overlay.addOnGesturePerformedListener(this);
    overlay.setGestureStrokeWidth(stroke);
    overlay.setGestureColor(color);
    overlay.setDrawingCacheEnabled(true);

1 个答案:

答案 0 :(得分:1)

我在绘制后更改手势颜色时遇到了同样的问题。找到您需要的解决方法:
1.获取并存储绘制的手势。
2.设置您选择的手势颜色
3.将手势设置回您的视图,就是这样!

希望我发现这不是太晚了..

Gesture gesture = signGesture.getGesture();
signGesture.setGestureColor(Color.parseColor("#FFFF0000"));
signGesture.setGesture(gesture);
相关问题