I recently got into android development. I just started on my first app and was wondering how to move the app title right next to the drawer icon instead of it being in the middle like this.Example
Is there anyway to do this at all? Thanks.
Normally,the app title is right next to the drawer icon. I think your layout file may have a problem, can you show you layout code?
Related
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.
I've been wondering about this question quite long time. How do they do that? Is the title just disabled and the HomeAsUp button is custom and contains the logo, arrow and text?
Do you know any other ways how to accomplish this?
You can achieve this by making a single image that contain both
- arrow.
- text.
- icon.
And the work on this single image action
I am new to android dev. I have a problem of adding a small tab on my left drawer.
Because it may be hard for user to detect that I have a left drawer so I want to add a tab to let people notice.
Here's the screenshot of my app.enter image description here
I hope it can have a small tab like this
Can you give me some hint to start?
You can just put a view on the left of your layout using relative layout and on click of that view you can just open the drawer by calling:
mDrawerLayout.openDrawer(Gravity.START)
This will open the drawer in the same way it open when action bar icon is clicked.
I have an android application that I want to add a sub menu for. The background of the application is the default which is black. All of the text on the app is white which I also think is the default. So I added in the sub menu but when I click on the sub menu the background turns to white but the text doesn't turn to black.
Any idea why the default sub menu behavior isn't working correctly? I'm hoping not to have to create styles and all that and the solution will be fairly simple.
Figured this out. This was due to me using titleCondensed instead of just using title. For some reason on sub menus it needs to use title but on the regular menu it works fine. Programming mistake by me.
I am working on an app for tablet that uses the Theme.NoTitleBar.Fullscreen: my tablet is under android 4.1.1 and the settings button should be on the top right corner of the app, but with such a style, the button (three little squares aligned vertically) is not visible... how can I fix that?
The button you are talking about is part of the title bar. So if you request to hide that one, your button is of course not accessible anymore.
You have to provide a button in your layout to access your settings screen. Or show the title bar.
You can use context menus for resolving this thing ... i was having the same problem... and if you want to use legacy overflow button (the three dots) please refer to this link http://android-developers.blogspot.in/2012/01/say-goodbye-to-menu-button.html