I want to add title under the icon that as default appears when i create the navigation drawer .
like in red border
Its not possible if you use normal ActionBarToggle, you can provide your own custom layout in toolbar and add menu icon to it but back animation will not work. Also you will have to handle click events on the menu your self
Related
I'm using new Navigation Component in my project. I created a custom Toolbar which will keep the Title in the centre even when having navigation drawer.
This is how my toolbar looks now.
I'm trying to put a custom hamburger and back icon there(basically i need white icons).
I've tried
dataBinding.appBarHome.toolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.drawable.ic_hamburger));
getSupportActionBar().setHomeAsUpIndicator(ContextCompat.getDrawable(this,R.drawable.ic_hamburger));
None of it is working. if want to see any specific part of my code, feel free to ask.
Maybe it just because of style or them,
Just try with bellow style
ThemeOverlay.AppCompat.Dark.ActionBar
When every you choose dark action bar then default icon color should be white and when you select an action bar then it will be the black icon
So just replace style in your manifest or style.xml
How can I change just one of menu item icon color in Android's navigation drawer? I don't want to change the entire drawers icon but just one icon.
I tried setting the android:iconTint property but that does not work.
i am developing an chat app in that there are two navigation drawer
Left side drawer has hamburger icon to open and close
i want to place an icon in the right side of the screen so that when the user touches icon the navigation drawer will open like in android emulator there is small icon extending to the navigation drawer
Use menu items like below:
<item
android:id="#+id/workteamaction"
android:icon="#drawable/yourimage"
android:title="#string/yourtitle"
app:showAsAction="always" />
And set your image.then, handle it for showing that NavigationDrawer.
Also, take a look:
Two Navigation Drawer on same Activity
Handling a Menu Item Click Event - Android
Also, i've saw one application was using OveflowMenu for opening another NavigationDrawer.you may want to take a look at here :
Android create custom overflow menu item
Edit:
i want to place an icon in the right side of the screen so that when
the user touches icon the navigation drawer will open like in android
emulator there is small icon extending to the navigation drawer
Use android:gravity="" for your porpuse and then handle it for showing that NavigationDrawer.
E.g: android:gravity="end"
Read the docs for the flags.(right-left-center-buttom or etc).
I use sliding drawer menu in my android project and
I use one drawer menu for all of myActivies
I want in root Activity when click on actionbar`s icon the drawer menu is open!
and in childs Activities when click on actionbar's icon go to parent Activity
like google play or gmail and ...
how I can do this?!
Implement the navigation as usual (with drawertoggle and everything), then call
_toggle.setDrawerIndicatorEnabled(false);
It will hide the drawer icon (the three vertical lines) and display the up caret. The up icon click event will not be handle by the drawer and will finish the activity (if you do so in the OnOptionsItemSelected).
yup, you can use Navigation drawer in the layout and as well as in the java code.
check this url for screenshot
https://developer.android.com/design/media/navigation_drawer_holo_dark_light.png
in my android project, I have set up a navigation drawer. Now, on swiping, the drawer works fine but I have a few problems that I'd liked solved.
There is no drawer icon to the left side of my launcher icon in the action bar. How do you implement that. Also when I click on the action bar icon, the navigation drawer does not slide in.
I would like to change the color of the text of my ListView inside my navigation drawer. I tried changing android:textColor in the xml layout but it didn't work.
I have the drawer_shadow.9.png drawable of the navigation drawer and I tried implementing it using the setDrawerShadow(drawable, gravity); method but it didn't seem to work. In the two parameters I added the drawable and the ListView R.id for the gravity.
That's just about it. Let me know if you need any more info. Thanks in advance.
There is no drawer icon to the left side of my launcher icon in the action bar. How do you implement that. Also when I click on the action bar icon, the navigation drawer does not slide in.
Use ActionBarDrawerToggle.
I would like to change the color of the text of my ListView inside my navigation drawer. I tried changing android:textColor in the xml layout but it didn't work.
If the "xml layout" is the one for the row, it should work. If the "xml layout" is the one for the drawer (where your ListView is), it should not work.
In the two parameters I added the drawable and the ListView R.id for the gravity.
From elsewhere in the DrawerLayout documentation, I think your interpretation of the second parameter is off:
Gravity.LEFT to move the left drawer or Gravity.RIGHT for the right. GravityCompat.START or GravityCompat.END may also be used.