简体   繁体   中英

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. 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. So you are not able to click any of the items in the overflow menu.

I'm using ActionBarSherlock 4.3.1.

Is this a bug? Should I file it on 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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