简体   繁体   English

在Android中扩展文本选择上下文操作栏

[英]Extending text selection contextual action bar in Android

I'm trying to extend the text selection contexual action bar with further actions. 我正在尝试通过进一步的操作来扩展文本选择操作。

So I added an ActionCallback via setCustomSelectionActionModeCallback method. 所以我通过setCustomSelectionActionModeCallback方法添加了一个ActionCallback。 It works fine, BUT: I'm addind several icons, so they don't fit in the actionbar on phones and they go to the overflow menu. 效果很好,但是:我添加了几个图标,所以它们不适合手机的操作栏中,可以转到溢出菜单。 The problem is: as soon as I click on the overflow button, it seems that the EditText looses the focus and so the ActionMode is closed and destroyed. 问题是:我单击溢出按钮时,似乎EditText失去了焦点,因此ActionMode被关闭并销毁。 So you are not able to click any of the items in the overflow menu. 因此,您将无法单击溢出菜单中的任何项目。

I'm using ActionBarSherlock 4.3.1. 我正在使用ActionBarSherlock 4.3.1。

Is this a bug? 这是错误吗? Should I file it on b.android.com? 我应该在b.android.com上归档吗? Is there a workaround? 有解决方法吗? One possible workaround may be the split action bar. 一种可能的解决方法是拆分操作栏。 But currently I don't need / want the split bar for the whole activity and switching programmatically is not possible as far as I know. 但是目前,我不需要/不需要整个活动的分割条,据我所知,无法以编程方式进行切换。

Is this a bug? 这是错误吗?

I think so. 我认同。

Should I file it on b.android.com? 我应该在b.android.com上归档吗?

Beat you to it by a year and a half . 一年半击败你 :-) :-)

Is there a workaround? 有解决方法吗?

None that I have found so far, in terms of a strict workaround. 就严格的解决方法而言,到目前为止,我还没有找到任何东西。 I did work out a sorta-solution: basically create your own "overflow" item in the action mode, which when clicking brings up a "nested" action mode of your own, giving you more room. 我确实设计出了一种解决方案:基本上是在操作模式下创建自己的“溢出”项,单击该选项会弹出自己的“嵌套”操作模式,为您提供更多的空间。 I haven't looked at my code for this in a while, and I recall it was fairly nasty. 我已经有一段时间没有看过我的代码了,而且我记得它很讨厌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM