选择文本并从标签xamarin表格中复制 [英] Select text and copy from label xamarin forms

查看:116
本文介绍了选择文本并从标签xamarin表格中复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天来,我一直在不同的论坛上阅读有关选择文本并从xamarin形式的标签中复制文本的问题,这似乎并不是实现此问题的直接方法.

I have for some days been reading on different forums about the issue of selecting a text and copying the text natively from a label in xamarin forms and it seems to be no straightforward way of implementing this.

我的问题是我需要在标签中呈现一本书中的大量数据,并且用户应该能够从标签中选择并复制大量文本. 我继续将数据显示在编辑器组件中,但随后用户可以在编辑器中编辑文本.将Editor组件设置为只读也不能解决问题.

My problem is that I need to present a large amount of data from a book in a label and the user should be able to select and copy a chunk of text from the label. I moved on to present the data in an Editor component instead but then the user can edit the text in the Editor. Making the Editor component read-only doesn't solve the problem either.

任何建议将不胜感激!

Any suggestions would be greatly appreciated!

推荐答案

我最近遇到了同样的业务需求.在每个平台上带有Renderers定制的Editor是我的解决方案.

I recently faced the same business requirement. An Editor with Renderers customization on each platform was the solution for me.

简而言之,Android renderer利用EditTextCustomSelectionActionModeCallbackCustomInsertionActionModeCallback属性来自定义上下文菜单以进行文本选择和插入,而iOS renderer非常简单明了,并设置了SelectableEditable UITextView的属性.

In short, Android renderer leverages CustomSelectionActionModeCallback and CustomInsertionActionModeCallback properties of EditText to customize context menu for text selection and insertion, while iOS renderer is pretty straight-forward and sets Selectable and Editable properties of UITextView.

查看我的 post ,其中包含Xamarin.Forms的完整代码.您还可以在本机上阅读帖子Android 本机iOS 以获取更多详细信息.

Check out my post with full code for Xamarin.Forms. You can also read posts on native Android and native iOS for more details.

这篇关于选择文本并从标签xamarin表格中复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆