I tried to look for a question like this here but couldn't find one.
I'm trying to implement something like Google Keep's "Add Label" in my Navigation Drawer and make that category stay permanently. I think the last part can be done with SharedPreferences. It's just the first I need help with. Any ideas as to how I can implement something similar? Or any examples I can take a look at? Thanks a lot.
You could use this method to add items:
dynamically add items to Navigation Drawer
Now it depends in what kind of dialog you want the user to enter them.
Related
I have an activity with a left pane and I need to change input fields when a different item is selected from the left pane.
I tried by adding a new activity but when the new activity show up the left pane disappears and the only way to get it back is by hitting the back button and I donĀ“t want that; the left pane must hide but must remain to select a new activity and let the user jump from one activity to any other that he choose.
How I cant get that?
I read also about something called fragments but since I'm new on this it looks a bit more complex.
I would review the documentation on Navigation, particularly on using a NavigationDrawer.
Hope that helps!
Refer to below Google Navigation Drawer Sample where you could find the correct way of implementing it.
https://github.com/googlesamples/android-NavigationDrawer
In addition I would recommend exploring bottom navigation, which is like the new navigation trends user enjoys.
Here is a code lab for it:
https://codelabs.developers.google.com/codelabs/android-navigation/#0
To choose which component to use for your app follow this material design guideline: https://material.io/design/navigation/understanding-navigation.html#lateral-navigation
Tip: To Speed up your development you can directly add Navigation Drawer Activity that will help you save a lot of time by adding the base code. Just add new Navigation Drawer activity by right clicking the package.
Hmm. Yes using fragments is the best solution. But you can also play around with hiding and showing views.
I wish to know if it is possible to do something. I know this is not the purpose of a drawer, but I have to use it something else than navigation in my case.
For example, it want to display some text, with drag and drop, the user can delete text or add new text with a button in it.
I can't display this text outside of this drawer because of UI.
I think it's not possible (I find nothing to do or talk about it on internet), if you can confirm this to me, it will be helpfull.
If you think it's possible, do you have any idea where to start ?
And, can I use a short video instead of an icon for an item ?
Thanks for your answer.
The DrawerLayout is just a different type of ViewGroup. You can place anything you want within it.
I'm not an Android ninja developer and I'd like to implement an app which has a Drawer Navigation and includes a tutorial.
Basically if you are in "My App" you should see a 5-6 steps tutorial.
The question is:
How can I implement that app?
I'd like to know how to organize it and which components I should use.
I'd really appreciate a step-by-step guide.
Thanks a lot.
This is a weird mockup of what I'm trying to implement :)
You can make an activity on top of drawer and then you can simply put view pager in Activity for tutorial. When user will finish tutorial you can move user to Drawer Navigation.
So you can use following method.
Check if user is visiting application for first time then show tutorial activity then move to Navigation Drawer. If user is visiting application for second time or more then you can directly move user to Navigation Drawer and start app.
If your tutorial is for the overall app, Jayesh's answer is right: you should put it in a separate Activity.
If the tutorial only demonstrates part of your app, i.e. only the drawer your are in, I suggest you use:
One MainActivity with a DrawerLayout. The latest SDK tools have a real cool template for NavigationDrawer, that will save you a lot of time!
In your TutorialFragment, write a layout with a ViewPager and the fixed bar at the bottom.
Add pages for your tutorial to this ViewPager.
In my application, I want to have behavior like facebook app wherein on click of icon I'd like to shift the whole screen towards right and display some menus on the left as shown below:
Before Clicking Menu Button
After Clicking Menu Button
One way is to have a layout with those menu in black color and set its visibility to gone
But in that case, the shifting animation won't be there like it is there in facebook. So is there any way we can do this?
This UI Pattern is currently being referred to as Side Navigation and discussed in some detail here:
http://www.androiduipatterns.com/2012/06/emerging-ui-pattern-side-navigation.html
The article also links to several projects that have implemented this navigation:
https://github.com/korovyansk/android-fb-like-slideout-navigation
https://github.com/darvds/RibbonMenu
https://bitbucket.org/jfeinstein10/slidingmenu/overview
https://github.com/Gregadeaux/android-fly-in-app-navigation
It is worth reading the article for its discussion about the issues with this kind of navigation also, though.
I have not implemented it but give you an exact idea that you have to use fragment for this.
Go through this link
This is the best that I've found https://github.com/DWorkS/ActionBarToggle because it's implementation is similar to DrawerLayout from google using ActionBarToggle. Although, it has a problem with open method but I wrote to its owner and he said that he will solve.
This is a bit difficult to explain, so I'll try to give a simple example to what I'd want to implement.
A. When the menu button is pressed in the Market app there are some kind of tabs on the buttom, how can I implement this ?
B.now press the settings (after you press the menu button in the Market app),
Is there a way to create this kind of a layout or I have to start from scratch (I would really appreciate code example for this if there is no 'easy' way to do this).
What you are referring to here is not a layout. This is the standard way of creating menues in Android applications.
Have a look at the following topic in the Android developer guide: http://developer.android.com/guide/topics/ui/menus.html
And regarding your second question: for settings/preferences, you can use a PreferenceScreen/PreferenceActivity. This is shown pretty well here: http://www.javacodegeeks.com/2011/01/android-quick-preferences-tutorial.html
If, by tabs you mean the buttons that pop up after clicking menu, you will have create your own options menu.
http://developer.android.com/guide/topics/ui/menus.html
EDIT: For B, check out the PreferenceScreen/PreferenceActivity, as mention in an answer to this post. Just updating here with link for convinience.
http://developer.android.com/reference/android/preference/PreferenceScreen.html
http://developer.android.com/reference/android/preference/PreferenceActivity.html