【发布时间】:2021-06-02 23:13:01
【问题描述】:
【问题讨论】:
标签: android xamarin xamarin.forms xamarin.android
【问题讨论】:
标签: android xamarin xamarin.forms xamarin.android
我对 Xamarin 一无所知。但在原生 Android 中,它是通过这种方式完成的。
向清单中的 Activity 添加意图过滤器:
<activity
android:name=".ProcessTextActivity"
android:label="@string/process_text_action_name">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
来自android:label 的文本将显示在上下文菜单中
在this Android developers blog post中有详细描述
关于同一主题的另一个问题:How to use the new Android M feature of "Text Selection" to be offered from outside of your app?
【讨论】:
对于您想要自定义菜单的每个TextView,您需要将自己的android.view.ActionMode.Callback 传递给TextView.setCustomSelectionActionModeCallback 函数。
在android.view.ActionMode.Callback 的实现中,您可以随意添加/编辑/删除项目。
更新:没有意识到这个问题在 Xamarin 平台上。 我想答案应该是相似的。
【讨论】: