How to make the Share action icon white instead of gray - android

My app has the ShareAction icon as displayed below. How I make it white instead of gray. It looks like it's disabled right now.
My XML is:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="#+id/menu_item_share"
android:showAsAction="ifRoom"
android:icon="#drawable/ic_action_share"
android:title="Share"
android:actionProviderClass="android.widget.ShareActionProvider" />
</menu>
ic_action_share is a white icon as shown below:

I think your ic_action_share IS gray, well you have to make a white image

Related

How to tint sub-menu icon with a color selector?

I'm building an android app with several menu on actionbar. And here is the menu.xml.
<menu>
<item
android:id="#+id/menu_comment"
android:icon="#drawable/gsm_comment_selector"
android:title="#string/COACH_COMMENT"
app:showAsAction="always"/>
<item
android:id="#+id/menu_more"
android:icon="#drawable/menu_more_selector"
android:title="#string/MORE"
app:showAsAction="always">
<menu>
<item
android:id="#+id/menu_share"
android:icon="#drawable/menu_share_selector"
android:title="#string/SHARE"/>
<item
android:id="#+id/menu_help"
android:icon="#drawable/menu_help_selector"
android:title="#string/HELP"/>
</menu>
</item>
</menu>
And this is what a XXX_selector looks like. It contains a drawable and a template_selector(a color state list) so I can change the icon color when I click it.
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/ic_more_vert_white_24dp"
android:tint="#color/template_selector"/>
The result is that when pressing menu_comment and menu_more, its icon color are changed. But menu_share and menu_help are not.
So what should I do to fix it?
Thanks
You should be able to do something like following (called from onCreateOptionsMenu)
Drawable drawable = DrawableCompat.wrap(menuItem.getIcon());
DrawableCompat.setTint(drawable.mutate(), context.getResources().getColor(tint));
view.setIcon(drawable);

android : remove border of share action icon [duplicate]

Have a look at the picture
This is how Share button looks like in action bar.
Here's the code I use in menu xml file:
<item
android:id="#+id/menu_item_share"
android:showAsAction="ifRoom"
android:title="Share"
android:actionProviderClass=
"android.widget.ShareActionProvider" />
Is it possible to remove that border or change its color?
Here is a more complet message :
In your style, add
<style name="_MidipileTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarItemBackground">#android:color/transparent</item>
</style>
drawable/action_background
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#color/background_actionBar"/>
</shape>
#color/background_actionBar is your custom background. For me, it's the same background color as actionBar background drawable.
You need to use custom background.
This might help:
https://developer.android.com/training/basics/actionbar/styling.html

app:showAsAction="always|withText" not showing text

I have an action bar with the follwing menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="br.com.putzbati2.PrincipalActivity" >
<item android:id="#+id/action_mensagem"
android:title="Mensagem"
android:icon="#drawable/barra_superior_envelope"
android:showAsAction="always|withText" />
<item android:id="#+id/action_carro"
android:icon="#drawable/barra_superior_carro"
app:showAsAction="always"
android:title="Meus Carros"/>
<item android:id="#+id/action_settings"
android:title="#string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
But the withText doesnt work. It shows only the icon.
I've already try to use android:showAsAction instead of app:showAsAction and when I do this, it doesnt show the icon neither the text. Does any one know how to help me?
I've found this solution, but as I said, it doesnt work for me
app:showAsAction ifRoom is not working on appcompat action bar
You can use like this:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="#+id/action_mensagem"
android:title="#string/id_item_mensagem"
android:icon="#drawable/id_item_mensagem"
android:showAsAction="always|withText" />
<!-- ... another items -->
</menu>
'always|withText' will work if there is enough room, otherwise it will only place icon! You are using so much items with text, probably you don't have room. So you will see only the icon.
You can check it if you rotate your application to landscape.

Invisible ActionBar Search Icon

So i set the theme as "android:Theme.Holo.Light.DarkActionBar", and i've added a search icon from holo.dark. However, it's impossible(nearly) to see this icon. Anyway to make it 'whiter'?
try this
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item
android:id="#+id/action_search"
android:actionViewClass="android.widget.SearchView"
android:icon="#android:drawable/ic_menu_search"
android:showAsAction="always"
android:title="#string/search_actionbar"/>
</menu>
am also using same theme for me action bar search icon showing white color only..

How can we add background Color to the options menu in android

Options menu has a default color i.e White, I want to change this color to GREEN.
Right now i have tried to add a drawable to my menu item to change its color, but its not working, here is the menu.xml code
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:icon="#drawable/character"
android:id="#+id/icon12"
android:title="test"
/>
<item
android:id="#+id/text"
android:title="Text"/>
<item
android:id="#+id/icon1"
android:title="Icon and Text"
android:icon="#drawable/item_selector"/>
<item android:id="#+id/about"
android:icon="#drawable/action"
android:title="about"
/>
</menu>
It does not change the background of the menu item. Any Answers would be appreciated.
I have tried many things, e.g hackandroid etc but nothing seemed to work properly.
Here is an artcile that describes customizing the look of the menu that I found useful.

Categories

Resources