Android upper Copy/Paste toolbar

android, android-actionbaractivity, android-activity, android-layout, android-theme

Solution

Create a custom style and specify the background to the color you want, and in your theme xml resource file, between the "style" element, set the "android:actionBarStyle" to the custom style you just created, it'll change the action bar color for you.

Updated: I just used the default folder for my theme resource (Note: the file name is arbitrary), if you want to create a theme resource for v-11 (API level 11) and up, create a new theme resource file (again, file name is arbitrary) with a "-v11" suffixed to the name of the file.

This is the default theme resource file since it inherits properties and attributes from the `Theme.AppCompat.Light.DarkActionBar`, as you can notice, in this file, you MUST not use the "android" namespace. If you have another theme resource file, like in the picture above, Android Studio automatically created the `stylex.xml(v21)` which is for Android version 21 and up devices. You MUST add the "android" namespace to each and every attribute such as the `actionBarStyle` would become `android:actionBarStyle`, but you should now that, the ActionBar has been deprecated since version 21, API level 5.

Also, the `displayOptions` attribute tells Android about how the title area is shown. These are availabe values:

- none

- useLogo

- showHome

- homeAsUp

- showTitle

- showCustom

- disableHome

Note: the `background` attribute ONLY accepts reference value, not hard-coded value.

Here is the result

Problem

I need your assistance with the following issue in android dev. For some reason when I extend ActioBarActivity the cut/copy/paste buttons are displayed correctly when I press the EditText component (see image 1). Unfortunately, if I extend Activity, the toolbar is not displayed correctly. You can see on image 2, that the buttons are present but they are white and the user cannot see them. I have investigated but I'm not sure how to fix this. If you need I can share the code but I think this can be easily reproduced. Thanks in advance. Paul

Original source