-
Book Overview & Buying
-
Table Of Contents
Android 6 Essentials
By :
Part of the material design guide specifications discuss text selection in your applications. Users select text within your app, and you now have an API to incorporate a floating toolbar design pattern that's similar to a contextual action bar. For more information about the design specifications, head to http://www.google.com/design/spec/patterns/selection.html#selection-item-selection.
The implementation steps are as follows:
Change your ActionMode calls to startActionMode(Callback,ActionMode.TYPE_FLOATING).
Extend ActionMode.Callback2.
Override the onGetContentRect() method and provide coordinates for the content Rect object in the view.
Call the invalidateContentRect() method when you need to invalidate the Rect object and it's position is no longer valid.
Floating toolbars are not backward-compatible. Appcompat takes control over ActionMode objects by default. This will prevent floating toolbars from being displayed.
The implementation steps are as follows...
Change the font size
Change margin width
Change background colour