Title for icon in actionbar is not shown - android

Hi I want to add a icon with title to my actionbar, but only the icon is shown. I created this item:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/menu_save"
android:icon="#android:drawable/ic_menu_save"
android:title="#string/menu_save"
android:showAsAction="ifRoom|withText"/>
</menu>
Anyone a idea? I also changed ifRoom to always but still the same problem..

That occurs in ICS, right? This appears to be a bug in ICS
https://code.google.com/p/android/issues/detail?id=30180

Related

Navigation Drawer showing only black icons

I want to change navigation drawer icons, i am trying below code in Menu.xml file. But it showing only black icon.
<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".Welcome"
tools:showIn="navigation_view">
<group android:checkableBehavior="single">
<item
android:id="#+id/nav_kirtan"
android:icon="#drawable/point_red"
android:title="XYZ"/>
</group>
Expected output -
Please help me...!
Add below line in Activity class...
mNavigationView.setItemIconTintList(null);
Try to add color like this :
<item
android:id="#+id/nav_kirtan"
android:icon="#drawable/point_red"
android:title="XYZ"
android:tint="#color/redColor"
/>
or you can also do
mNavigationView.setItemIconTintList(null);
This disables all state based tinting.

i can't add the menu icons to the tool bar in visual studio xamarin

it seems that what ever i did i cant set the icons visible to the tool bar, i've tried to do researches on many platforms, but nothing helped.
here is the xml menu:
<?xml version="1.0" encoding="utf-8" ?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/event_ic"
android:icon="#mipmap/ic_event"
android:title="profile"
android:showAsAction="always"
/>
<item
android:id="#+id/details_menu"
android:title="details"
android:showAsAction="never"/>
</menu>
you can see that even if i set the android:showAsAction to always, i still get the event item in the pop up menu without the icon.

Can I show icon in overflow menu of Android Toolbar?

Please take in consideration that I'm refering to the Toolbar Widget(Android L/API 21+)
By overflow menu and icons I mean something like this one :
Something more difficult : Is there any way that the icons appear on the RIGHT side of the text?
create a menu in menu, for example: main_activity_actions.xml
and use this code for the toolbar, try it:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:All4One="http://schemas.android.com/apk/res-auto">
<item android:id="#+id/algo"//some id
android:icon="#drawable/kami_nomi_zu_shiru_sekai3" //add the image
android:title="nose"
All4One:showAsAction="always">
<menu>
<item android:id="#+id/WIFI"//option to display on the menu
android:icon="#drawable/nisekoi1"//this is a option of the submenu
android:title="#string/WIFI"/>
<item android:id="#+id/DATOS"
android:icon="#drawable/nisekoi6" //this one also is a option
android:title="#string/DATOS"/>
<item android:id="#+id/BT"
android:icon="#drawable/sao1"
android:title="#string/BT"/>
<item android:id="#+id/NADA"
android:icon="#drawable/nisekoi6" //the same
android:title="#string/NADA"/>
</menu>
</item>
</menu>

Actionbar not shown with AppCompat

I am backporting my app to API7 with AppCompat and have a problem with the actionbar.
When I use FragmentActivity the actionbar is shown on my phone (API18), but with ActionBarActivity it shows up as the optionmenu by pressing the menubutton.
On the emulator with API7 the actionbar is always shown as an optionsmenu.
Any ideas?
Use the compat name space for your menu items like this:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:compat="http://schemas.android.com/apk/res-auto" >
<item android:id="#+id/action_whatever"
android:icon="#drawable/ic_action_whatever"
android:title="#string/whatever"
compat:showAsAction="ifRoom" />
</menu>
Related to a duplicate that points to this post, I was having trouble making my buttons appear as action items instead of overflow items, despite having showAsAction set to always. I managed to coerce it by extending my activity with Activity instead of ActionBarActivity. According to this answer, this is acceptable if you don't need to support api levels below 11.
...extends ActionBarActivity:
...extends Activity:
I do debug with Doogee Valencia Y100Pro, and menu as "three little square" not visible, but when I extended my MainActivity with android.support.v7.app.ActionBarActivity, then I obtain text/icon menu in action bar. Next screenshot and menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/action_update"
android:icon="#drawable/ic_refresh"
android:title="#string/action_update"
app:showAsAction="always"/>
<item android:id="#+id/action_settings"
android:title="#string/action_settings"
app:showAsAction="ifRoom"/>
</menu>

How to create an OK/Submit button in the ActionBar?

I actually have two questions:
Is there a way to mark a menu item in the ActionBar as the OK/submission button, or is it just a regular item?
Is there a built-in theme for an OK button in the ActionBar (maybe something that looks like a tick-mark?) or must I create my own image file?
I found this icon in Sherlock, it looks like a tick mark and it seems to do the job:
abs__ic_cab_done_holo_light.png
So this is my menu xml (located in res/menu):
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/done_item"
android:icon="#drawable/abs__ic_cab_done_holo_light"
android:showAsAction="always"
android:orderInCategory="1"
android:title="#string/done">
</item>
</menu>

Categories

Resources