How to create a back item in ActionBar? - android

I would like the home item look like the back button in the ActionBar in Android 3.0 app. The look is similar to Market app (see the screenshot below marked in red):
I know there is a standard method to add an "up" affordance to the home button in action bar. But haven't seen a standard way to add a back arrow.
Is there a standard way to do it (maybe subclassing of ActionBar/Activity etc.)? If anyone has an example or has done something like this - it would be very nice if you could share it. Thank you.
UPD: if I use setDisplayHomeAsUpEnabled(true), it adds an up affordance as this - see a tiny up arrow on the left:
Maybe there is a way to style this "up" arrow to be a "back" arrow?

But haven't seen a standard way to add a back arrow.
That is the "up" affordance. Call setDisplayHomeAsUpEnabled(true) on your ActionBar to toggle it on.

Related

Custom BottomNavigationView Interactive options layout Fragments

I recently put my hands on Android development and hence have to ask here a query that I have.
In my test app I have a BottomNavigationView, which has 3 options to click. I have seen in many apps that if a selection is tapped it further slides up another sub menu. I couldn't find enough information about this feature.
Looking for a direction if anyone has came across such requirement in the past.
This feature is deprecated now. look at say goodbye to menu button
if you still want to perform some action on navigation buttons, Override onBackPressed method in your activity so that you are able to perform some action on click of back button of bottom navigation bar.

Android - Slide Menu like in Uber

I am looking to implement a menu like used on the Android Uber app.
It seems to be like an action bar on top with 3 small settings stripes on left side. (probably not a real action bar)
When clicking in that area a black menu slides out from the left and occupies 70% of the screen.
The right side of the screen still showing the map is darkened to keep focus on the menu.
I like that style, it looks good and everyone immediately knows how to use it.
I would like to have the same but don't know where to start or if there is maybe something available that would do something similar.
The actionbar itself only offers the menu on top right which is better for pure settings.
I also experimented with a split action bar having the menu items on bottom but that also seems superior to the clean interface Uber provides.
You want the Android Navigation Drawer. It's an Android sanctioned navigation pattern and more details about it can be found here. For some more technical documentation and an example of how to use it, you can find a sample over here. It works great with the Action Bar so shouldn't need anything too custom outside of what the Android v4 compat library gives you.

Moving a view left of the screen

My android app UI have two parts- a menu bar (blue color) and content area (gray color).
Here red is the device screen.
The menu bar should open from left to right whene the hamburger menu is clicked.
I tried with ViewSwitcher but that shows only one view at a time.
What is the right method to implement it?
UPDATE: I am looking for the solution for API level 10 onwards.
In the newest version of the ADT you can select Navigation Drawer as navigation type when you create a new Activity. This automatically implements this type of navigation for you.
Alternatively, check out this tutorial: http://developer.android.com/training/implementing-navigation/nav-drawer.html
If you are happy with the navigation bar overlaying the content, then use the navigation drawer as suggested.
Alternatively check out:
https://play.google.com/store/apps/details?id=com.desarrollodroide.repos
There are many open source libraries that you can pick and test, and then decide which one to grab the code for.

Non-standard back button in Action Bar Android

I've seen in several apps a non-standard back button (image #2) in the action bar,
Normally when I config a navigation drawer or the setDisplayHomeAsUpEnabled it just looks like image #1
How can i accomplish the non-standard style?
That is not a back button. It is sometimes called a "hamburger icon", and it is specifically used for indicating the presence of DrawerLayout navigation. You can find more information in the Android documentation. You can see more about the icon's functionality here.

Dropd down tabs or drop down menus beneath ActionBar in Android

My need is to add a drop down menu like the one shown in attached image link.
http://i.imgur.com/cWtykfN.jpg
I don't know what to be used, whether it is tabs or menus. My need is when I press the last tab/menu, the sub menu should be shown and I could be able to handle the corresponding actions. Even when I handle those menus, I should be able to show the top tab/ menu without interruption.
It's called as overflow menus. Look this example, you will get an idea.
http://wptrafficanalyzer.in/blog/adding-action-items-and-overflow-menu-items-to-action-bar-in-android/
And nice explanation been given here. http://blog.stylingandroid.com/archives/1249 and for source code.ref here: https://github.com/StylingAndroid/StylingActionBar/Tree/StylingPart2
Use the ActionBar with tab-navigation-mode and if the last tab is clicked you could simply trigger a PopupMenu (even though this seems a little weird and is not what I expect to happen when I click tab).

Categories

Resources