xamarin.forms - 如何在选择图像以及保存时使用标签动态获取x和y值而不是硬编码,同时在该位置显示数字
问题描述
我有两个要求
1.我只使用customimagerenderer参考链接获得了x和y坐标:https ://social.msdn.microsoft.com/Forums/en-US/50318e68-4e06-4d08-8d2d-d839f720d006/how-do-i -put-points-on-image-and-get-coordinates-of-those-points-?forum=xamarinforms
2.第二个选择特定位置的图像我添加了数字,例如:1,2,3 如果有任何可能的解决方案来实现请发送,我不知道如何实现这一点。谢谢提前
<AbsoluteLayout>
<StackLayout>
<Image Source="mypic.jpg" x:Name="pic"/>
</StackLayout>
<Label Text="1" x:Name="firstlabel"
BackgroundColor="Transparent"
TextColor="Red"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds=".1,.1,10,10"
/>
<Label Text="2" x:Name="secondlabel"
BackgroundColor="Transparent"
TextColor="Red"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds=".1,.2,10,20"
>
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="on_Tapped"/>
</Label.GestureRecognizers>
</Label>
<Label Text="3" x:Name="thirdlabel"
BackgroundColor="Transparent"
TextColor="Red"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds=".8,.1,10,20"
/>
</AbsoluteLayout>
也尝试上面的代码,但 AbsoluteLayout.LayoutBounds 设置硬编码也他们设置了多个标签
解决方案
推荐阅读
- ssl - 您不是此证书的域的授权所有者
- c - 将所有位设置为最低有效位
- google-app-engine - 静态文件被解释为具有不同 MIME 类型的文档
- r - 防止 ggplot2 降低 x 轴水平
- angular-cli - Angular 7.2 - ng new project 命令在我的根目录中创建了一堆 node_modules
- c++ - 如何修复井字游戏中的随机数生成器
- python - 查找具有多个“子”对象的 Django 模型记录?
- python - Python:如何计算熊猫数据框中 1 的分数?
- angular - Angular Form Valid Observable subcribe 找不到 onvalid 事件
- java - Java中断/停止定时器