gpt4 book ai didi

java - 多种颜色/笔画手势和在同一个 GestureOverlayView 中持续绘图

转载 作者:太空宇宙 更新时间:2023-11-03 13:27:22 25 4
gpt4 key购买 nike

<分区>

我见过很多使用手势绘图的例子。我的要求是,我想在同一个 GestureOverlayView 中绘制多色和多笔划手势。为了更清楚,请看下图。

enter image description here

如果用户选择不同的颜色和不同的笔画,绘图应该是各自的颜色/笔画。现在,它绘制不同的颜色和不同的笔触手势,但是如果我选择不同的颜色或不同的笔触,之前绘制的手势也会采用新的颜色或新的笔触

一个类似的问题得到了回答here但有同样的问题。

请提出建议。

<android.gesture.GestureOverlayView
android:id="@+id/signaturePad"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:eventsInterceptionEnabled="false"
android:fadeEnabled="false"
android:fadeOffset="122000"
android:gestureStrokeLengthThreshold="0.1"
android:gestureStrokeWidth="6"
android:gestureStrokeType="multiple"
android:orientation="vertical" >

</android.gesture.GestureOverlayView>

在java代码中,改变颜色代码

mGestureOverlayView.setGestureColor(Color.BLUE);

谢谢。

编辑: 想用 Canvas 实现相同的功能,并从 here 获得代码.它绘制多条线,但问题是当我更改颜色/笔划时,最近绘制的线条也采用了新的颜色/笔划。请建议这里出了什么问题。

编辑(答案): 终于得到解决方案。看看this链接。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com