Two toolbars showing up in Navigation Drawer in Android -


i trying show particular toolbar in fragment connected through navigationdrawer.

i have navigationdrawer extends appcompatactivity has particular toolbar showing properly.

now kike show toolbar has drop down etc. when click on fragment, 1 coming fine old toolbar. how hide toolbar showing old one?

see snapshot below:

enter image description here

like above instead of toolbar title rediff/dropdown toolbar come there?

so how hide old toolbar , show new one? toolbar spinner:

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/tools"     android:id="@+id/toolbar"     style="@style/actionbar"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:background="@color/backgroundcolor"     android:minheight="?attr/actionbarsize"     app:theme="@style/themeoverlay.appcompat.dark.actionbar" >      <spinner         android:id="@+id/spinner"         android:layout_width="wrap_content"         android:layout_height="wrap_content"/>  </android.support.v7.widget.toolbar> 

here have in fragment:

mtoolbar = (toolbar) rootview.findviewbyid(r.id.toolbar);          if (hidetoolbar)         {             ((appcompatactivity)getactivity()).getsupportactionbar().hide();         }         else         {             ((appcompatactivity)getactivity()).getsupportactionbar().show();         }           if (mtoolbar != null)         {             ((appcompatactivity) getactivity()).setsupportactionbar(mtoolbar);             ((appcompatactivity) getactivity()).getsupportactionbar().setdisplayshowtitleenabled(false);         }          navspinner = new arraylist<spinnernavitem>();         navspinner.add(new spinnernavitem(getresources().getstring(r.string.all)));         navspinner.add(new spinnernavitem(getresources().getstring(r.string.week)));         navspinner.add(new spinnernavitem(getresources().getstring(r.string.month)));          adapter = new navigationadapter(getactivity(),  navspinner);         mspinner = (spinner) rootview.findviewbyid(r.id.spinner);         mspinner.setadapter(adapter);         mspinner.setonitemselectedlistener(this); 

use same toolbarfor activity

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/tools"     android:id="@+id/toolbar"     style="@style/actionbar"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:background="@color/backgroundcolor"     android:minheight="?attr/actionbarsize"     app:theme="@style/themeoverlay.appcompat.dark.actionbar" >      <spinner         android:id="@+id/spinner"         android:visibility="gone"         android:layout_width="wrap_content"         android:layout_height="wrap_content"/>  </android.support.v7.widget.toolbar> 

in activity getreference spinner

when launch fragment make spinner visible/gone

i.e

getactivity().spinnerinmainactivity.setvisibility(view.visible); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -