Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To change the color/etc of the text in a contextual action bar:</p> <pre><code>public boolean onCreateActionMode(ActionMode mode, Menu menu) { //mode.setTitle("Contextual Action Bar"); (replace this call) TextView tv= (TextView)getLayoutInflater().inflate(R.layout.contextual_title, null); tv.setText("Contextual Action Bar"); mode.setCustomView(tv); </code></pre> <p>where layout/contextual_title.xml contains a single TextView with your desired color/size/style etc</p> <p>In fact, almost everything in a contextual action bar can be styled. The only problem is that searching for the word 'contextual' leads nowhere useful. The relevant styling features are all called "actionMode...". Here are some I used (defined in my Theme.)</p> <pre><code>&lt;item name="android:actionModeCloseDrawable"&gt;@drawable/check&lt;/item&gt; &lt;item name="android:actionModeCutDrawable"&gt;@drawable/ic_menu_cut_holo_dark&lt;/item&gt; &lt;item name="android:actionModeCopyDrawable"&gt;@drawable/ic_menu_copy_holo_dark&lt;/item&gt; &lt;item name="android:actionModePasteDrawable"&gt;@drawable/ic_menu_paste_holo_dark&lt;/item&gt; &lt;item name="android:actionModeSelectAllDrawable"&gt;@drawable/ic_menu_selectall_holo_dark&lt;/item&gt; &lt;item name="android:actionModeBackground"&gt;@drawable/contextual&lt;/item&gt; &lt;item name="android:actionModeCloseButtonStyle"&gt;@style/MyCloseButton&lt;/item&gt; &lt;!-- these change the press backgrounds for the vanilla actionBar and for search --&gt; &lt;item name="android:windowContentOverlay"&gt;@null&lt;/item&gt; &lt;item name="android:selectableItemBackground"&gt;@drawable/bar_selector&lt;/item&gt; &lt;item name="android:actionBarItemBackground"&gt;@drawable/bar_selector&lt;/item&gt; &lt;!-- these were defined in platform/.../data/res/values/... but Eclipse didn't recognize them --&gt; &lt;!--? item name="android:actionModeShareDrawable"&gt;@drawable/icon&lt;/item --&gt; &lt;!--? item name="android:actionModeFindDrawable"&gt;@drawable/icon&lt;/item --&gt; &lt;!--? item name="android:actionModeWebSearchDrawable"&gt;@drawable/icon&lt;/item --&gt; &lt;!-- item name="android:actionModeBackground"&gt;@drawable/red&lt;/item --&gt; &lt;!-- and finally --&gt; &lt;style name="MyCloseButton" parent="android:style/Widget.ActionButton.CloseMode"&gt; &lt;item name="android:background"&gt;@drawable/bar_selector&lt;/item&gt; &lt;/style&gt; </code></pre> <p>You can easily set your own text-editing cut/paste/copy/selectall icons, the bar background, and the icon background that changes color when you press the icons(bar_selector above). The icons are ImageViews, not buttons, and the edit id's (and the pressable background) are attached to the ImageView's parent (one parent per view) which is an 'internal' type.</p> <p>It's never clear what goes where in the styles--I found where selectableItemBackground was in the platform Themes.xml, and copied and modified the drawable pointed at.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload