I have a list view and a navigation drawer I want to make an application in which clicking on item on a list view will open a navigation drawer for each item. For example list view are students and in navigation drawers we have tests, achievments and informations different for each student. I have no idea how to do it and I need a clue to start with.
I will be very greatful for each advice,
You can open NavigationDrawer whenever you need by
private DrawerLayout mDrawerLayout;
if (mDrawerLayout.isDrawerOpen(listView)) {
mDrawerLayout.closeDrawer(listView);
} else {
mDrawerLayout.openDrawer(listView);
}
But you shouldn't do it.
This is not what a NavigationDrawer is for. You should opt for, for instance, a PopupMenu for it.
Or you can choose from many interactive libraries. Consider SwipeListView. It will show all the options you want to show when a user swipes the ListView item (student).
Try looking into learning about Fragments and listview adapters.
Google has a detailed tutorial for working with the navigation drawer, http://developer.android.com/training/implementing-navigation/nav-drawer.html.
Related
I am making an app which has a navigation drawer. This navigation drawer has 50 menu items. These items have the same layout, same activity but different data.
I want to implement ViewPager in my app so that the user could swipe left and right (manually and automatically).
Issue: I am facing an issue of how to implement this. The activity (for these menu items) has its own methods and functionality. A ViewPager can slide fragments but my issue is that since all of these menu items have the same layout and functionality then it would be much better to use one fragment whose data change with swipes for each menu items.
I don't know how to approach this. Please guide me.
You can do it by using a recycleView,and you will need an arrayAdapter which will help you adapt the data accordingly and you will need to have a separate class that will have all the data you want, you can also have different constructor in that class. You can check this to know more https://www.codexpedia.com/android/a-very-simple-example-of-android-recyclerview/
Take a look at the Fitbit application Play Store. It has a navigation drawer and the Dashboard item is swipable (basically you can swipe from today to yesterday, to the day before, etc.). My question, how can this be done?
I've read that it's recommended to use the navigation drawer with fragemnts. So if Dashboard is a fragment, how can we swipe that fragment left and right to change views? Is each date just a different view?
https://developer.android.com/training/implementing-navigation/lateral.html
https://developer.android.com/training/implementing-navigation/nav-drawer.html
The Dashboard looks like it is part of a ViewPager, which lets you swipe left or right to switch views. The drawer is a standard implementation of DrawerLayout (android.support.v4.widget.DrawerLayout).
I have implemented a basic Navigation Drawer.
I understand Android Drawer Navigation utilizes Fragment (Nav1 opens Frag1, Nav3 opens Frag3).
I want to achieve Frag1 (or the Home Activity) as a list (i.e., ListFragment) And, when an object on the list is clicked it will take me to Frag4....Frag10 depending on what is clicked.
In another term,
Drawer Menu (Nav1...Nav3)
Home Activity (Could be Frag1) is a list and a swipe tab << This is where I am stuck.
Other Activities are Swipe tabs too...
Any suggestion, close example?
Thanks
OK, I have found the answer, a very simple solution. Create ListFragment class. And in the main class just receive the list!
I have taken help from ListFragment
I am developing an android application where I need to put a navigation drawer which would have more than 3 levels.
What I want to do: If I click one item of my list in the drawer, a whole new list comes up in the drawer. This new list should also do the same when items of this list are clicked. This could go on for many levels.
What I have done till now: I am keeping an expandable list which expands when I click on any item. This design doesn't allow adding more levels.
Application which have similar drawers: svpply (please have a look at this application, it has a similar drawer)
I am a newbie in android development, try to add details to your ideas.
Thanks!
Have a single drawer keeping a FrameLayout.
Make all your list as ListFragment
Make Fragment Transaction on FrameLayout when a item is clicked.
I am using a DrawerLayout for the main menu. By clicking one of the menu items, I start an activity that has a master-detail relationship (that uses SlidingPaneLayout). However, when the user closes the navigation drawer and does not choose any menu item, he is presented with a blank screen, which I find is annoying. I would like to present the master-detail relationship (that uses the SlidingPaneLayout) instead.
Reading the documentation for DrawerLayout, I understood that the DrawerLayout can have only two child elements - a FrameLayout and a ListView. I was wondering if it is possible to incorporate a SlidingPaneLayout with a DrawerLayout?
Thank you.
There's no problem to do that. The DrawerLayout can have only two child, but of any kind. You can for example have two framelayouts, and replace one of them with a fragment containing a SlidingPane. I've actually done that on some projects without problems.