Menu Item in Action bar hide in small screen in android - android

I am using an actionbar with actionbar tab in an app. i have menu item and three tab with home icon in actionbar.
BUT When i run this app on emulator if menu item has property showAsAction with value "ifroom" then some of them are appear because of no more room
but the menu icon at the right upper corner is missing everytime i run this app.
Here is the image what is come in emulator :
and image below what i need :
here is my code for menu.xml:
<item android:id="#+id/menu_add" android:title="Add" android:icon="#drawable/icon" />
<item android:id="#+id/menu_DashBoard" android:title="DashBoard" />
<item android:id="#+id/menu_Master_Entry" android:title="Master Entry" />
<item android:id="#+id/menu_Product_Section" android:title="Product Section" />
<item android:id="#+id/menu_Retailers_Orders" android:title="Retailers Orders" />
<item android:id="#+id/action_search" android:icon="#drawable/search_icon"
android:title="Search" android:showAsAction="ifRoom" android:layout_gravity="left"/>
<item android:id="#+id/action_calender" android:title="Calender"
android:showAsAction="ifRoom" android:icon="#drawable/calender" android:layout_gravity="left" />
<item android:id="#+id/action_message" android:title="Message"
android:showAsAction="ifRoom" android:icon="#drawable/messageicon" android:layout_gravity="left"/>
Please help .. why it is come and what is the solution of this problem?
THANKS in advance. I only want that this menu dropdown at the last in actionbar should be shown in each screen size but it disappear in phone and shown on tab(10.1)

You can change android:showAsAction="ifRoom" to android:showAsAction="always"but this is not recommended.
If there is not enough room this items are added to more option at the end of the action bar where thr title of this item is shown in a drop-down (kind of) list.

Related

Swipe the menu items of bottom navigation bar

I am trying to add 4 items in menu of Bottom Navigation View but I cant figure out how to make it swipeable. The screenshot looks like this. I have figured out the increase in size but once I get to know the swiping so that a complete name can be visible or either wrap text can be applied.
My menu file is;
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/menu_1"
android:title="Triggered Insan" />
<item
android:id="#+id/menu_2"
android:title="Carry Minati" />
<item
android:id="#+id/menu_3"
android:title="Hadd Bc" />
<item
android:id="#+id/menu_4"
android:title="Lakshay Chaudhary" />
</menu>

Android navigation app change the icon of listed menus

I have use this code for menu icon but does not displayed in app why?
Please help me to to display icon left side of navigation menu list
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="#+id/income"
android:icon="#drawable/ic_income"
android:title="Income" />
<item
android:id="#+id/expense"
android:icon="#drawable/ic_expense"
android:title="Expense" />
<item
android:id="#+id/nav_settings"
android:icon="#drawable/ic_setting"
android:title="#string/nav_settings" />
</group>
</menu>
We have to set icon list as null then only it display the icon in navigation menu list
For that use following this code
navigationView.setItemIconTintList(null);

How to hide the actionbar menu item based on tab layout?

I have a actionbar_layout and three tabs in my android application.The actionbar_layout is common for all the three tabs(Event tab,Invitation tab,Groupchat tab).The actionbar_layout have 3 icons(dropdown,event icon & settings icon). I need to visible that icons based on tab click,for example when ontap invitation tab "settings icon" only visible in actionbar layout,if click event tab only "event icon" need to be visible.Similarly when on tap Groupchat tab i need to visible "dropdown icon".
How to achieve this please help me
My menu_user_dashboard.xml code is below
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:appmunu="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="ringee.app.com.ringeeapp.UserDashBoard">
<item
android:id="#+id/dropdown"
android:icon="#drawable/dropdown_icon"
android:title="Dropdown"
appmunu:showAsAction="always">
<menu>
<item
android:id="#+id/all"
android:title="All" />
<item
android:id="#+id/event"
android:title="Event" />
<item
android:id="#+id/invitation"
android:title="Invitation" />
</menu>
</item>
<item
android:id="#+id/create_occasion"
android:icon="#drawable/ic_action_event"
android:title="Create Occasion"
appmunu:showAsAction="always" />
<item
android:id="#+id/account_settings"
android:orderInCategory="100"
android:title="#string/action_settings" />
<item
android:id="#+id/profile"
android:orderInCategory="100"
android:title="#string/profile_image" />
</menu>
you can hide or show menu item in OnCreateOptionsMenu on behalf of some flags
like when user select any item then set flag true for that item and call
invalidateOptionsMenu()
after this you can change visibility
MenuItem item = menu.findItem(R.id.menu_Done);
if (flag/condition)) {
item.setVisible(false);
} else { }

Placing icons to action bar

I am placing icons to action bar. It looks like this:
Why search icon is more white? I want to do same color with setting icon. How can I do this?
My xml:
<item android:id="#+id/action_favorites"
android:icon="#drawable/ic_search"
android:title="Takip Listesi"
android:showAsAction="always" />
<item android:id="#+id/action_settings"
android:icon="#drawable/ic_action_settings"
android:title="Settings"
android:showAsAction="always" />
My images:
http://www.imgim.com/ic_action_search.png
http://imgim.com/image/ic_action_settings.png
Note: Images are white, probably you can't see on browser. Please download it.

Honeycomb Drop-down options menu. How to show?

How to create Drop-down options menu for Action Menu items for HoneyComb?
I have 5 Action Menu items and I want add dropdown to menu_feed_share(share button):
menu.xml
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/menu_feed_share" android:showAsAction="ifRoom"
android:icon="#drawable/icon_share" />
<item android:id="#+id/menu_feed_browser" android:showAsAction="ifRoom"
android:icon="#drawable/icon_web" />
<item android:id="#+id/menu_feed_bookmark" android:showAsAction="ifRoom"
android:icon="#drawable/icon_bookmark" />
<item android:id="#+id/menu_feed_search" android:showAsAction="ifRoom"
android:icon="#drawable/icon_search" android:actionViewClass="android.widget.SearchView" />
<item android:id="#+id/menu_feed_settings" android:showAsAction="ifRoom"
android:icon="#drawable/icon_preferences" />
</menu>
I created SpinnerAdapter and listener, but I do not know how to show dropdown, how to assign dropdown to button share..
SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.share_list, android.R.layout.simple_spinner_dropdown_item);
actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
Can anybody help me?
Thanks!
upd..
I want like something(here is menu. I need the same for Share-betton):
So, it's simple:
Thanks all!
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/menu_feed_share" android:showAsAction="ifRoom"
android:icon="#drawable/icon_share">
<menu>
<group
android:id="#+id/menu_nav_group">
<item
android:id="#+id/fb_menu"
android:title="Facebook"/>
<item
android:id="#+id/twitter_menu"
android:title="Twitter"/>
<item
android:id="#+id/mail_menu"
android:title="Mail"/>
</group>
</menu>
</item>
<item android:id="#+id/menu_feed_browser" android:showAsAction="ifRoom"
android:icon="#drawable/icon_web" />
<item android:id="#+id/menu_feed_bookmark" android:showAsAction="ifRoom"
android:icon="#drawable/icon_bookmark" />
<item android:id="#+id/menu_feed_search" android:showAsAction="ifRoom"
android:icon="#drawable/icon_search" android:actionViewClass="android.widget.SearchView" />
<item android:id="#+id/menu_feed_settings" android:showAsAction="ifRoom"
android:icon="#drawable/icon_preferences" />
</menu>
This is not an "Actions Menu" but an "Options Menu" see: http://developer.android.com/guide/topics/ui/menus.html for more information on menus in Android.
use: onCreateOptionsMenu and onOptionsItemSelected to make this work. I belive that the dropdown menus like your picture shows are only seen in Honeycomb tablets. Other phone android OS will have these menu options show on the bottom of the screen as seen in the link above. Hope this answers your question.
How to create Drop-down Navigation for Action Menu items for HoneyComb?
You don't, any more than you create "Drop-down Navigation for Action Menu items" in other versions of Android. Android has never supported "Drop-down Navigation for Action Menu items". There isn't even a concept in Android of "Action Menu" -- I am guessing that you mean "options menu".
There is "list mode" for an action bar, which displays a Spinner, but that is not associated with an options menu item.

Categories

Resources