How to change actionbar like gmail - android

I would like to create a actionbar, let it like gmail's actionbar.
In other words,
When the item is selected in listView, actionbar's logo will change to the Cancel button.
Does this have to custom actionbar's layout?
or , it is not a actionbar ,it's a Contextual Menus?

thanks #Selvin and #CommonsWare
it's a context-menu, ListView or RecyclerView, and you can just call startActionMode() to start it (API 11 or later).
But in startActionMode(), it will not call onItemCheckedStateChanged,
you must implement a click listener from the adapter by yourself.

Related

Android ActionBar Custom Design

I am a newbie in android programming, i have to design an activity exactly like the picture in the link. I am extremely confused about how to add that search view under my actionbar.
you need ToolBar .find some example and you can modify its layout because its just a ViewGroup. Then use it as ActionBar.
You have to make a custom action bar, below will can help you to make it.
How can I implement custom Action Bar with custom buttons in Android?
then, you have to use text watcher(http://www.learn2crack.com/2014/02/android-textwatcher-example.html) in search textbox and use these methods acc. to your need:
1. afterTextChanged
2. beforeTextChanged
3. onTextChanged

Android Actionbar PopupMenu with Custom Item Layouts

I am working on an Android application where I have to design a menu which will populate from the action bar, like this:
I have tried my best but was not able to produce it using the Android controls.
The solutions I have tried are:
With Actionbar, add a menu item with a group with selectable="all", that produces the layout I need but when I click a checkbox for selecting it, the whole menu hides and selection is not done, moreover the menu icon in actionbar does not have the bottom right white arrow.
Tried creating a custom ActionProvider and added the menu items using class's OnPrepareSubMenu method but had the same issue.
I just need a push in the right direction and I can do the rest, suggestions are more than welcome.
Thank you :)
Use popupWindow.
In that you can make any custom layout and set it as content of your popupwindow and also you can specify an ANCHOR in your case it would be
R.id.your_menu_item
set a listener and listen the changes.

How to use Actionbar Tabs and Actionbar Spinner at the same time?

I want to implement app which will download data and set it into ActionBar Tabs. I've already implemeted it, but I have one more thing to do. I've tried to add actionbar list, like this one, but android doesn't allow to use Tabs and List at the same time :( After pressing on one of the items in List, application should download corresponding data and fit it into my app. (Example) So how could I do that? Is there any way to fit spinner in Action Bar? if yes, please provide example.
I could do it this way:
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
navigation is tabs, but the ActionBar has a custom view.
bar.setCustomView(R.layout.custom_actionbar);
bar.setDisplayShowCustomEnabled(true);
That custom_actionbar contains the spinner.

How to imitate ActionBar menu?

Is possible create something like this without using ActionBar? I just need "button" which will rolling some items after click...
ActionBarSherlock might be useful in your case: http://actionbarsherlock.com/
A "dirty" method would be to link your button to an invisible Spinner, which will become visible as soon as the button is pressed. Then it's simply a case of binding the onSelect event of the spinner and theming it.

Action bar list navigation + tab navigation - Position of spinner is not at left most

According to Jake as in Android layout with action bar and tabs, we decide to follow his 2nd suggestion.
Use tab navigation in the action bar and set a custom view with a Spinner
Together with IcsSpinner from ActionBarSherlock itself, we manage to make it work in Gingerbread and ICS both.
However, we still suffer the following problem, during landscape mode.
Note, the spinner ("Portfolio 1") is in between PORTFOLIO tab and search icon. What we want is, the spinner is at the left side of WATCHLIST tab.
Is there anything we may try out?
Thanks.
You can set custom view for your action bar, user RelativeLayout to put your spinner at left side of "WATCH LiST"
in java code: actionBar.setCustomView(R.layout.custom_actionbar_layout)
a very late answer, but this is possible. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here's the link

Categories

Resources