Force to show icon + text toolbar menu item - android

<item
android:icon="#drawable/ic_public_white_24dp"
android:id="#+id/action_public"
android:orderInCategory="0"
android:title="Public"
app:showAsAction="always|withText">
I have this item, I am trying to force to show simultaneously.
If I remove the icon, appears the text "Public", but if I have icon then only appear it.
Is it possible to force to show both? I read a lot of info about it and this app:showAsAction="always|withText" should force this...
I tried this:
<?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"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:icon="#drawable/ic_public_white_24dp"
android:id="#+id/action_public"
android:orderInCategory="0"
android:title="Public"
app:showAsAction="always|withText">
And it is not working for me.
I am in Android Studio 3.0 beta 5

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.

Option menu checkbox android

I have a problem with the option menu checkable item
I want the checkbox be placed right of title not under it.
He is my option.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">
<group android:checkableBehavior="single">
<item android:id="#+id/notif"
android:title="Notification"
android:checkable = "true"/>
</group>
</menu>
Thanks.
This will only be the case in the menu preview in Android Studio. On your device it will display as expected.
For example:
In Android Studio, mine looks like yours:
When I start the application and check, it looks like I expect:
Hope this helped!

I want to design text search using search view.. that will search the whole text in android application

<?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_search"
android:title="#string/action_search"
android:orderInCategory="60"
app:showAsAction="ifRoom|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView"
android:icon="#drawable/ic_search_black_24dp"/>
Already designed the search view bar, but unable to add functionality. please help. Design code that will search the entire text within the fragment and layout of my android application.
thanks in advance.

Title for icon in actionbar is not shown

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

Categories

Resources