See the screenshot attached. My "Previous" and "Next" icons, whose color code is #FFFFFF, are somwhat darker than the system icons for "Up" and "Overflow".
This is a problem because it leads some users to assume that the buttons are disabled.
My theme on the AppBarLayout is ThemeOverlay.AppCompat.Dark.ActionBar and on the Toolbar is ThemeOverlay.AppCompat.Light, in case that matters. I am using appcompat-v7:23.0.1.
Here's the layout XML ...
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="#+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
... and the relevant parts of my Activity code.
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home_activity);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
adapter = new HomePagerAdapter(getFragmentManager(), this);
viewPager.setAdapter(adapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
tabLayout.setupWithViewPager(viewPager);
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
}
#Override
protected void onResume() {
super.onResume();
if (forms == null) {
forms = getConfiguredForms();
}
}
#Override
protected void onStart() {
super.onStart();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.home_activity_actions, menu);
return super.onCreateOptionsMenu(menu);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.uploadButton:
intent = new Intent(HomeActivity.this, UploadActivity.class);
startActivity(intent);
return true;
case R.id.settingsButton:
intent = new Intent(HomeActivity.this, SettingsActivity.class);
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Here's the XML for the options menu. They are added by a fragment.
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/firstButton"
android:icon="#drawable/first_white"
android:title="#string/first_action"
app:showAsAction="ifRoom" />
<item
android:id="#+id/previousButton"
android:icon="#drawable/previous_white"
app:showAsAction="always"
android:title="#string/previous_action" />
<item
android:id="#+id/nextButton"
android:icon="#drawable/next_white"
app:showAsAction="always"
android:title="#string/next_action" />
<item
android:id="#+id/lastButton"
android:icon="#drawable/last_white"
app:showAsAction="ifRoom"
android:title="#string/last_action" />
<item
android:id="#+id/resetButton"
android:icon="#drawable/reset_white"
app:showAsAction="never"
android:title="#string/reset_action" />
</menu>
In your styles.xml add the following attributes to the style to hide the default ActionBar:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Related
I want to make an app with a custom toolbar with a menu on the toolbar. The problem I have is that when I run the app and I click on the menu on the right side of the toolbar, the options do not appear but the menu box appears. One of the options closes the app and if I click the menu area where the exit option is the app closes.
Here is my activity_main.xml file:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/toolbar_color"
android:id="#+id/toolbar"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="#string/app_name"
app:logo="#drawable/applogo">
</androidx.appcompat.widget.Toolbar>
Here is my mainActivity.java:
public class MainActivity extends AppCompatActivity {
Toolbar toolbar;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
}
#Override
public boolean onOptionsItemSelected(#NonNull MenuItem item) {
int id = item.getItemId();
if(id == R.id.exit)
{
this.finishAffinity();
}
return true;
}
}
This is my menu.xml file:
<?xml version="1.0" encoding="utf-8"?>
<item
android:title="#string/new_entry"
android:id="#+id/add">
</item>
<item
android:title="#string/about"
android:id="#+id/about">
</item>
<item
android:title="#string/exit"
android:id="#+id/exit">
</item>
I created the toolbar xml I set it in MainActivity .. I created the menu xml and I inflate it in MainActivity from all the tutorials these are the steps that I had to go through to get here, yet I don't know why the items in the menu xml file won't show up in the emulator.
Big thanks to Gabriele Mariotti. In his words: " The issue is the text color in the popup menu." .All I had to do was to was to add the following line of code to the Toolbar xml.
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
Try this one I have made a demo for you it is working I have tested it on the emulator as well as the device.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/teal_700"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Hello World!" />
</RelativeLayout>
MainActivity
public class MainActivity extends AppCompatActivity {
Toolbar toolbar;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.my_menu, menu);
return true;
}
}
my_menu
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/item1"
android:title="Item 1"
app:showAsAction="never" />
<item
android:id="#+id/item2"
android:title="Item 2"
app:showAsAction="never" />
<item
android:id="#+id/item3"
android:title="Item 3"
app:showAsAction="never" />
<item
android:id="#+id/item4"
android:title="Item 4"
app:showAsAction="never" />
</menu>
Now I have this
But I want to make this:
<?xml version="1.0" encoding="utf-8"?>
<item
android:id="#+id/menu"
android:icon="#drawable/ic_menu"
android:title="#string/title_menu"
app:showAsAction="always" />
<item
android:id="#+id/file"
android:icon="#drawable/ic_file"
android:title="#string/title_file"
app:showAsAction="always" />
<item
android:id="#+id/new_file"
android:icon="#drawable/ic_new_file"
android:title="#string/title_new_file"
app:showAsAction="always" />
<item
android:id="#+id/visual"
android:icon="#drawable/ic_eye"
android:title="#string/title_eye"
app:showAsAction="always" />
<item
android:id="#+id/print"
android:icon="#drawable/ic_print"
android:title="#string/title_print"
app:showAsAction="always" />
<item android:id="#+id/help"
android:icon="#drawable/ic_help"
android:title="#string/title_help" />
This menu I add in activity
override fun onCreateOptionsMenu(menu: Menu): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.designer_options_menu, menu)
return true
}
And I don't understand how I can install ic_menu at the left side
You can use the Up/Home button for doing that by using a custom toolbar within a CoordinatorLayout:
1. Main layout
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<!-- My Layout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
2. Your menu
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/folder"
android:icon="#drawable/ic_folder_black_24dp"
android:orderInCategory="1"
android:title=""
app:showAsAction="always" />
<item
android:id="#+id/file"
android:icon="#drawable/ic_insert_drive_file_black_24dp"
android:orderInCategory="2"
android:title=""
app:showAsAction="always" />
<item
android:id="#+id/eye"
android:icon="#drawable/ic_remove_red_eye_black_24dp"
android:orderInCategory="3"
android:title=""
app:showAsAction="always" />
<item
android:id="#+id/print"
android:icon="#drawable/ic_print_black_24dp"
android:orderInCategory="4"
android:title=""
app:showAsAction="always" />
</menu>
3. Java
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
getSupportActionBar().setTitle("");
}
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Toast.makeText(this, "Home", Toast.LENGTH_SHORT).show();
break;
case R.id.eye:
Toast.makeText(this, "Eye", Toast.LENGTH_SHORT).show();
break;
case R.id.file:
Toast.makeText(this, "File", Toast.LENGTH_SHORT).show();
break;
case R.id.folder:
Toast.makeText(this, "Folder", Toast.LENGTH_SHORT).show();
break;
case R.id.print:
Toast.makeText(this, "Print", Toast.LENGTH_SHORT).show();
break;
}
return super.onOptionsItemSelected(item);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
}
4. Style: use NoActionBar theme
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
</resources>
5. Gradle:: add design support library for coordinator layout
implementation 'com.android.support:design:28.0.0'
The result
Simpler Version
Add android:icon to your Main Activity or whatever Activity you want this icon:
<activity
android:name=".Main"
android:icon="#drawable/ic_settings_white_24dp"
android:launchMode="singleTop">
Enable the "home" icon in your Main.java:
getActionBar().setDisplayShowHomeEnabled( true ); // In your onCreate() or wherever.
You might also want to hide the back icon in the top left and the app name in the top left. You can do that with these two commands:
// Disable back icon in top left and hide app name.
getActionBar().setDisplayHomeAsUpEnabled( false );
getActionBar().setDisplayShowTitleEnabled( false );
To handle the click event you just need to capture the home in onOptionsItemSelected:
#Override
public boolean onOptionsItemSelected( MenuItem item ) {
switch( item.getItemId() ) {
case android.R.id.home:
// Do something.
return true;
}
}
Worked for us and the end result is something like this:
With AppCompatActivity
You need to do this slightly differently if your Activity is extending from AppCompatActivity. Here are the changes to the steps above:
No need to add android:icon to AndroidManifest.xml.
Set the Icon to use in your Main.java Activity and use getSupportActionBar():
getSupportActionBar().setHomeAsUpIndicator( R.drawable.ic_settings_white_24dp );
I'm using 25.3.1 support library. I have Fragment in my app with setHasOptionsMenu(true). After menu has been inflated, menu icons does not accept color from styles, they stay black (as original vector resource) instead of my text color as I wrote in styles. What am I doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="#color/toolbarBackgroundColor"
android:theme="#style/AppTheme.Toolbar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
/>
</android.support.design.widget.AppBarLayout>
Here is toolbar style:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
</style>
<style name="AppTheme.Toolbar" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<item name="colorAccent">#color/colorAccent</item>
<item name="actionMenuTextColor">#color/textColor</item>
<item name="android:textColorPrimary">#color/textColor</item>
<item name="android:textColorSecondary">#color/textColor</item>
</style>
And here is my code from Fragment
#Override
public void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
mTopLevelModeEnabled = true;
}
#Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.order_menu, menu);
}
I'm building Xamarin Android application and I want to implement right navigation drawer with drawer toogle in a custom action bar. Everything is working (drawer slides from right side,...) except one thing: the navigation drawer icon is not showing.
So, this is my Activity.axml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:id="#+id/drawerLayout">
<!-- Main Content -->
<FrameLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:id="#+id/map" />
...
</FrameLayout>
<!-- Right Navigation Drawer -->
<LinearLayout
android:orientation="vertical"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#f2f2f2">
...
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
And this is my Activity.cs:
using Android.Support.V4.App;
using Android.Support.V4.Widget;
...
public class Activity : Activity
{
...
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToogle;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
ActionBar.SetDisplayShowHomeEnabled(false);
ActionBar.SetDisplayShowTitleEnabled(false);
ActionBar.SetCustomView(Resource.Layout.CustomActionBar);
ActionBar.SetDisplayShowCustomEnabled(true);
SetContentView(Resource.Layout.Activity2);
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);
mDrawerToogle = new ActionBarDrawerToggle(this, mDrawerLayout, Resource.Drawable.ic_drawer,Resource.String.open_drawer_layout, Resource.String.close_drawer_layout);
mDrawerLayout.SetDrawerListener(mDrawerToogle);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
...
}
protected override void OnPostCreate(Bundle savedInstanceState)
{
base.OnPostCreate(savedInstanceState);
mDrawerToogle.SyncState();
}
public override void OnConfigurationChanged(Configuration newConfig)
{
base.OnConfigurationChanged(newConfig);
mDrawerToogle.OnConfigurationChanged(newConfig);
}
public override bool OnOptionsItemSelected(IMenuItem item)
{
if (mDrawerToogle.OnOptionsItemSelected(item))
{
return true;
}
return base.OnOptionsItemSelected(item);
}
...
}
This is my Themes.xml:
<resources>
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar"
parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:height">75dp</item>
<item name="android:background">#00000000</item>
</style>
</resources>
Am I doing something wrong? Any help is appreciated.
UPDATE
My CustomActionBar has app icon and app title. Is this maybe interrupting navigation drawer icon?
This is the solution I have found.
First, you need to add action_bar.xml file with the following content to the menu folder:
<?xml version="1.0" encoding="utf-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/personalInfoActionBar"
android:title="Informations"
android:icon="#drawable/infoIcon"
android:showAsAction="always"/>
</menu>
Then insert this code in your activity:
public override bool OnOptionsItemSelected(IMenuItem item)
{
if (item.ItemId == Resource.Id.personalInfoActionBar)
{
if (mDrawerLayout.IsDrawerOpen(mRightDrawer))
{
mDrawerLayout.CloseDrawer(mRightDrawer);
}
else
{
mDrawerLayout.OpenDrawer(mRightDrawer);
}
return true;
}
return base.OnOptionsItemSelected(item);
}
Don't forget call actionbarDrawerToggle.syncState()
I learnded to use Android NavigationView,it was shown well but could't response to click event.
Here are my codes. I want to show a Toast when i click any item.but it doesn't work...
nav = (NavigationView) findViewById(R.id.navigation);
//nav.setClickable(true);
nav.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
#Override
public boolean onNavigationItemSelected(MenuItem item) {
item.setChecked(true);
Toast.makeText(getApplicationContext(), "caonima", Toast.LENGTH_SHORT).show();
return false;
}
});
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item android:icon="#drawable/homepage"
android:title="首页"
/>
<item android:id="#+id/psychology_item" android:title="日常心理学" android:icon="#drawable/right"/>
<item android:id="#+id/recommand" android:title="用户推荐日报" android:icon="#drawable/right"/>
<item android:id="#+id/movies" android:title="电影日报" android:icon="#drawable/right"/>
<item android:id="#+id/internet" android:title="互联网安全" android:icon="#drawable/right"/>
<item android:id="#+id/noboring" android:title="不许无聊" android:icon="#drawable/right"/>
<item android:id="#+id/desingn" android:title="设计日报" android:icon="#drawable/right"/>
</group>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<FrameLayout
android:id="#+id/tool_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<android.support.design.widget.NavigationView
android:fitsSystemWindows="true"
android:id="#+id/navigation"
android:layout_gravity="start"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:headerLayout="#layout/navigation_header"
app:menu="#menu/nav_menu"
/>
</android.support.v4.widget.DrawerLayout>
it has disturbed me for two days, i find some question use listView ,
or add drawerView.bringToFront();drawerView.requestLayout();
But nothing changed.
by the way , i used toolbar in a fragment like this
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_main_title,container,false);
mToolbar = (Toolbar)v.findViewById(R.id.main_title_toolbar);
mDrawerLayout = (DrawerLayout) getActivity().findViewById(R.id.drawer_layout);
mToolbar.setTitle("首页");
mToolbar.setTitleTextColor(getResources().getColor(R.color.text));
((AppCompatActivity)getActivity()).setSupportActionBar(mToolbar);
mToolbar.setNavigationIcon(R.drawable.navigation);
setHasOptionsMenu(true);
mToggle = new ActionBarDrawerToggle(getActivity(),mDrawerLayout,mToolbar,
R.string.drawer_open,R.string.drawer_shut){
#Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
drawerView.bringToFront();
drawerView.requestLayout();
}
#Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
}
};
//mDrawerLayout.addDrawerListener(mToggle);
mToggle.syncState();
return v;
}
Oh, i just so a article.it has solved my problem.
here is the link : enter link description here
You just have to bring your drawerLayout to the front,
so try to use these two method
mDrawerLayout.bringToFront();
mDrawerLayout.requestLayout();
then you can find it solved,if you want know more about this,search"Z order".