我正在开发一个绘图应用程序,我正在使用 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.获取并存储绘制的手势。
2.设置你喜欢的手势颜色
3. 将手势设置回您的 View ,就这样!
希望我发现这个还不算太晚..
Gesture gesture = signGesture.getGesture();
signGesture.setGestureColor(Color.parseColor("#FFFF0000"));
signGesture.setGesture(gesture);
关于android - 如何在同一手势叠加层中绘制多色手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24503929/