I watched some videos for navigation drawer in android studio .. some people started from an empty activity and other used Navigation Drawer Activity from the Starter ..
So what's the difference ?
And what activity i have to implement ?
(my first activity is splash screen and all others activity will be added as new activity, btw I'm doing a football application so advice me <3)
Android studio provides you some templates as starting point with boilerplate code to get you started quickly on your project.
If you select DrawerActivity, It will create one of the templates, you can use which has all the boilerplate implementation for the Drawer Menu.
On the other hand, if you select EmptyActivity, It will just an create an activity with nothing in it (mostly blank or HelloWorld TextView in it, depending on studio versions).
By the way, you can always create an EmptyActivity and add things gradually like drawermenu etc in it if you prefer this way.
Empty activity : It has just the white screen and nothing else.
NavigationDrawer activity : Empty screen integrated with Navigation Drawer
Related
I am newbie Android 'developer'. I want to launch my application with two Activities: ListView (with optional slide up panel) and Navigation Drawer. I began my project from taking Navigation Drawer Activity and I modified it. Now, I want to add ListView but how to do it? I have tried to add this before android.support.design.widget.NavigationView in activity_main.xml but It doesn't work. Maybe should I add a new Activity in function onCreate in MainActivity class? Any ideas?
Thanks
I am developing an Android project with Android Studio.
I would like to have the menu is always accessible in every view like Google Play Store (the Sidebar) and App Store (the Bottom selection bar).
I am thinking to do it in two ways:
Make my app have only one activity with Navigation Drawer, all the other views are above this activity using fragments.
Recreate the sidebar or bottom selection bar every time I switch to another activity.
Both of these two ways are very complex and cost a lot. Do you have some better ways?
PS: If not, could you suggest me some links about how to implement these two methods?
Thanks a lot.
you can create a MasterActivity that extend Activity and contain your sidebar. other Activity can extend from your MasterActivity by this way you can access your sidebar on each activity.
I think you should use the default navigation drawer and default action bar.
If you are using the Android Studio then
right click on your package and go to New/Activity/Navigation Drawer Activity.
That will create navigation drawer fragment and activity automatically.
But If you are using Eclipse then these links will be useful for you.Navigation Drawer
Action Bar
you can use include tag in other layout activity and call Navigation Drawer:
<include
android:id="#+id/nDrawer"
layout="#layout/your_NavigationDrawerLayoutName"/>
I am creating an Android application with a bottom bar. I used an Android fragment to create the bottom bar and it is working well. Now I want to add some more activities to the application. The problem is I can't get my bottom bar fragment in the Activity. Is there any way to bring my fragment into an Android Activity? I tried this and a lot of other examples from the Google. Can anyone help me bring my fragments to an Activity?
I am using HoloEverywhere + ActionBar Sherlock + HoloEverywhere's sliding menu addon. When clicking an item in the sliding menu, I start various activities.
My problem is to implement what Cyril Mottier talks about in his article about Prixing's SlidingMenu:
- overriding activity transitions (that's the easy part)
- saving/restoring the menu state between activities (that's what I can't manage to do): currently the menu disappears and it does not feel right. I would like to save the menu state and when the next activity starts, restore that state (and animate the close of the menu for instance)
Cyril talks about using the view's saveHierarchyState, ...:
The Activity transition in the Prixing application relies on the exact same technique the Android framework uses to restore an Activity after it has been destroyed in low memory conditions. As a result, everytime a new Activity needs to be opened, we save the the interesting part of the current UI state using View#onSaveInstanceState()/View#saveHierarchyState(SparseArray<Parcelable>) and re-apply it to the newly created Activity thanks to View#onRestoreInstanceState(Parcelable)/View#restoreHierarchyState(SparseArray<Parcelable>)
However I have trouble seeing how to implement that? Would anyone have any clue?
My activities all inherit from a base activity class which keeps its instance of the sliding menu.
See SlidingMenu issue
You can update code from the last version of SlidingMenu to same module of HoloEverywhere.
Or wait 1.4.3, where this module will be updated by me.
I want to create a app with a menu at the bottom of the screen. This menu should be visible any time the app is started.
Im working with fragments, so the menu is one fragment.
So I have only one Activity as controller which loads different fragments above the menu fragment.
Because I want to create clean code, i dont know how to solve the problem that the Activity class is too big.
In other words, i want to create different controller within the same activity. How to do that?
Is there another approach to solve this issue?
You should be using the split action bar This allows you to put the Actions and overflow menu on the bottom of the screen. I believe you can use Action Bar Sherlock for backwards compatibility to older versions of Android. See their site for detail.
Another possibility is to look into using fragments with the ViewPager . Here is a library that works with compatability as well ViewPageIndicator . Here is a blog post , like I indicated in my comment I got this working with the tabs showing at the bottom and the pages above.