So I'm basically a total beginner in things of app programming.
I started with the "Navigation Drawer Activity" from Android studio and my problem is, I want the nav drawer toggle icon (top left corner) and the "3 dotted icon" (top right corner), but I don't want it in a toolbar.
My question is, should I remove the toolbar and keep the Icons (if so, how could I do that) or should I make the toolbar fullscreen (don't know how to remove the appname)?
Or is there any better way? Like starting from scratch and placing the icons where I want?
Thanks in advance!
What you see as "nav drawer toggle icon" is actually an ActionBarDrawerToggle object and as its name suggests it can only reside in a Toolbar.
The "3 dotted icon" is the toolbar's menu button. You can create a new button with the same icon and use it to popup a menu but it's not that simple.
Remember that the Toolbar is a container and you can customize it the way you want, so my advice is to use it because the other option is a lot harder.
You can set:
in xml
android:elevation="0dp"
or
app:elevation="0dp"
or bycode
getActionBar().setElevation(0);
to remove any elevation of the toolbar.
A few years ago I did something similar to what I think your wanting to do. I made my app so that I had a navigation drawer and settings icon but styled it so that there was no actual visible bar. This gave the app a bit so generic feel and more of a modern look. Also made the drawer and settings menu feel more integrated with the app as a whole. Unfortunately this is a bit of an involved task. For one this in a way, in the sense that they are a "guideline" and that this goes against the idea of making the flow and feel of the app to be what the user is expecting in the traditional sense, goes against the Google Material Guidlines. And two the activity templates are good for learning and generic apps. If your trying to make something that customized is generally going to require you to create everything from scratch. Three, I find I have slight of trouble with the navigation drawer template the Android Studio provides. I'll use it to play around with ideas or to get a feel of how I want my app but if I'm ready to start coding my "production level" app I then start a new project with no activity and make everything myself. Now...
It sounds like what you want is a navigation drawer, which requires a toolbar, but don't want your app name to display. The three simplest solution here would be to go to the strings.xml and in there is a line like so.
<string name:"app_name">YourAppName</string>
Clear that line. (This may cause issues I haven't treated recently and am unable to atm)
There will still be a visible bar across the top though. So if that is not the desired effect, it would be simpler to create a new project with either a black activity or no activity. Google search Android how to create styles and themes and then Google search android navigation drawer with kotlin. Look for a tutorial that shows how to make a navigation drawer from either a blank activity or no activity. Then you will have to create your own style that either doesn't have a color or set the background transparency, of the appbar which is inside/apart of the toolbar, to 100%. I can't remember which because it's been a long time.
I hope this helps.
P.S. Thanks for this question it gives me a great idea for a blog post on my website "How to create a Navigation Drawer with no visible app bar in Kotlin". Once I get it made I'll add a link and can maybe edit my answer with some code detailing the style and theme modifications.
Related
I've been reading/youtubing a lot about how I should start my next app and found out that the activities suggested as start activities in Android Studio may contain deprecated elements such as the ActionBar, and that I should rather start from scratch without an activity, and use the newly lollipop-introduced "Toolbar".
My question is: As I need a top bar of a kind (ActionBar/Toolbar) and a navigation drawer in my app, should I invest the time it needs to build the Toolbar opposed to starting with a NavigationDrawer activity from the beggining?
Will using an NavigationDrawer activity (with an ActionBar) mean that I'm staring a new app with old-fashioned kind of top bar?
Very first thing ActionBar is not deprecated and not old style component. It still serves the purpose well. Toolbar only comes into existence when you need more than ActionBar, for instance, you want to increase the height of ActionBar and want to inflate some custom views then ActionBar might not be a right choice. If you just need an Activity with NavigationDrawer, I don't think so you need a ToolBar at all. Just create a new project from scratch and pick NavigationDrawer as a pre-configured option while creating the project and you are good to go. ActionBar is not going anywhere, at least for now. Hope it would help.
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.
I've implemented a navigation drawer, and it has the standard 3 lines going across.
I've been looking around for methods to change that icon, but I haven't found much luck. I really only want to make the lines more spaced out and longer (like in the playstore).
Any suggestions?
If I understand correctly, you're looking to change the
icon
There is a Navigation Drawer Indicator Generator in the Android Asset Studio.
The icon is available for download in the Android training lesson Creating a Navigation Drawer.
As far as I can tell, you can follow that tutorial and swap in whatever icon you'd like.
as I pursue my study on android app development I came across this app from apple and I was wondering if, is there a way to imitate the navigation drawer in this screen shot?!
See it's an expandable navigation drawer. a list view with some items that are expandable. Is there an actual way to imitate this on android?
Thank you very much again for all of your help.
You can recreate that drawer.
You can use the ExpandableListView within the Navigation Drawer. And of course you'll have to create your own parent and child item layouts for the listview. As well as appropriate styling. You can use tutorials to do this, first create the navigation drawer, then create the expandablelistview and put it within the navaigation drawer layout.
I'd also like to note on that screen shot, the drawer is incorrect. It should slide out below the action bar, over-top of the activity (like in the link). It should not slide the entire application window to the right like how some apps do.
Use a Custom ListView for this, see here for that: How To Create A Custom Listview - Android Example
Also, you will have to create specialized buttons that have a different look than standard holo buttons, see here for that: How to create custom button in Android using XML Styles
Finally, I do not believe it is possible to directly clone the navigation drawer, as the app you showed doesn't have an open sourced app (as far as I know).
I am developing an app on Android and would like to use the similar menu bar like Google Plus or Facebook, when you click the button, the menu bar will slide in and will not occupy the whole screen. Any ideas on that?
Thanks.
A pretty popular library for accomplishing the 'sliding menu' effect (or 'drawer' as the design guidelines on the Android developer website prefer to call it) is Jeremy Feinstein's SlidingMenu. It's also compatible with ActionBarSherlock, in case your project is using that too. Unfortunately, at this stage there is no component built into the SDK that allows you to do easily accomplish the same thing.
There are also a couple of alternative implementations for a sliding menu (do a search either here on SO or Google), but I haven't checked those out for a little while. If I recall correctly, there are especially some variations in terms of whether the ActionBar is supposed to slide along with the content or stay fixed at the top of the screen.
You can use FrameLayout in parent view and use translate animation in menu layout to show the slide in and slide out effect.