Moving a view left of the screen - android

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.

Related

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.

Android navigation bar on left side

There is a task to display the navigation bar on the left side for android 4.4.2. Nothing of the sort found. Is it possible to do this?
Or, for example, to hide the navigation bar, and on the left side add own custom menu on the same level of layouts hierarchy order content is shifted to the size of the menu?
This solution should work everywhere, not just in one application.
Thanks for the help.
As far as I know you see that navigation bar there because you are using emulator genymotion. On real devices you should not be able to see it. Besides, those back button are physical buttons on some devices like samsung s2.
If you want a menu on the left you should implement navigation drawer. Good luck

Option menu in Android like a Windows 8 phone

I am trying to implement a menu just like in Windows 8 phone. When I touch three dots menu bar button, it slides up and shows other options. I saw a sliding drawer in Android, but it is deprecated in API 17. I searched on Google but did not find solution. Any ideas on how I could implement this?
You can see a picture of the menu view.
You can do this in many ways. I.e. by using RelativeLayout as main container and separate i.e. LinearLayout as your menu container. And you then show/hide your menu container when you need. And you can apply animation to container.

Benefits of native ActionBar vs custom implementation?

I would like to try and use the native Google ActionBar class for my application however, I would like to be able to change the left most image dynamically, disable the icon and center the title. I was wondering if this is possible of if I should implement my own ActionBar?
My reason for wanting to change the left most image (IE the navigation drawer indicator) is because I am using the navigation drawer but on some screens would like to display the up indicator instead.
Looking through the documentation for the ActionBarDrawerToggle, there is a method to enable/disable the navigation drawer icon (setDrawerIndicatorEnabled), when disabled it reverts to the home-as-up indicator.
Another option is to recreate the drawer in those specific screens you want the icon different and specify the new icon in the creation of the drawer, not sure if this would work though.
http://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html
Here is the android guide which explains how to do this, but allow me to give a brief overview.
You do not have to have the app icon as the leftmost icon so in certain pages you can disable it by specifying another "android:logo" item in the XML file, or by simply diabling it entirely.
The android logo, which is what you are talking about as the "leftmost item", can have an onClickListener() set for it which is how you can change it simply to an uparrow image which you can download from google.

Creating Android Facebook-like menu on bottom bar

I'm using Galaxy tab and it's got a bar on bottom that appears all the time.
FB app shows a new item there that used as a menu button.
How can I declare my menu to be there like FB?
Thanks!
I guess they are still using the old options menu. You can achieve that effect by setting the target sdk to max 10. I wouldn't recommend that as the menu button hides information and is not the current way to go (I'd use an ActionBar)
You should definately look at the ActionBar. In addition to the tab navigation that is available, you have an option for a split action bar for top and bottom. ActionBar is part of Honeycomb (3.x), but if you want to support older versions, there is the ActionBarSherlock library.

Categories

Resources