navigation-drawer

Coloring Android Status Bar in Nav Drawer

杀马特。学长 韩版系。学妹 提交于 2019-11-30 20:16:43
In this app I'm building, I've added a Navigation Drawer fragment into my activity. I'm using 5.0, so I've been able to set the primaryColor and primaryColorDark to get the right colors. I've decided to try and style my Nav Drawer to be very similar to Google Now's drawer in 5.0, where the Nav Drawer has it's own background for the status bar. (Can't post pictures, not enough reputation >.>) I've followed this question's recommendations here , which has helped quite a bit. I've achieved drawing my Nav Drawer under the status bar when I pull it out. Only trouble is, I can't figure out how to

Navigation Drawer is slow with complex view

孤人 提交于 2019-11-30 20:10:29
In my app i'm using Navigation Drawer and it works very fine. But if the Fragment to show contains much TextView, ImageView and Layout, when i click the item, the view is glitching. I would improve this lag. The effect is the same by my Galaxy Nexus and with Nexus 4 so i think the problem is that i have 2 comands in the same time. //On item click - First comand (Close Drawer) mDrawerList.setItemChecked(position, true); setTitle(mStringTitles[position]); mDrawerLayout.closeDrawer(mDrawerView); // Second comand (Replace Fragment) getFragmentManager() .beginTransaction() .replace(R.id.firts_view,

Android lollipop toolbar switch between open/close drawer and back button

家住魔仙堡 提交于 2019-11-30 19:34:56
I had standart navigation drawer, but now i'm trying to modify it, using toolbar. Earlier my code looked like: MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.v("MAIN", "CREATE"); initViews(); setListeners(); getFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { shouldDisplayHomeUp(); } }); mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id

how to implement navigation drawer without action bar but opens the navigation screen with a button on main screen?

烈酒焚心 提交于 2019-11-30 19:10:16
问题 navigation drawer app that have login screen on its left_drawer fragment (see link: how to show a activity(login screen) under android navigation drawer ), I want to open this login screen from the main screen using a button and also don't want the action bar on navigation drawer. Can any one please help me with this? Thanks In advance!! 回答1: It's quite simple actually. Easier than with ActionBar. I'm writing the answer with almost simplest of layouts make your xml something like this:

Hiding contexual action bar while navigation drawer is open

强颜欢笑 提交于 2019-11-30 18:43:14
The question is similar to this except for the fact that instead of using a View Pager (VP) I want to use a Navigation Drawer (ND). I have a list of elements that activates a Contextual Action Bar (CAB) when one/several items are selected through long press actions. When the ND is opened I want to hide temporarily the CAB and show the basic action bar, while when it is closed to show again the CAB with the selected items. The feature is specified in the ND official documentation "Hide contextual action bars while the drawer is visible.". So far I couldn't find anywhere how to make it in a nice

Change ActionBarDrawerToggle icon android in toolbar?

核能气质少年 提交于 2019-11-30 18:37:18
I have an activity with navigation drawer and toolbar Activity public class MainActivity extends AppCompatActivity { private Toolbar toolbar; private CustomTextViewMondaRegular tvTitle; private ListView mDrawerList; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); mDrawerList = (ListView) findViewById(R.id.left_drawer); tvTitle =

Navigation drawer header textview nullpointerexception

孤街浪徒 提交于 2019-11-30 18:04:08
问题 I have an 2 activity and a service, in first I have navigation drawer, and 2 textviews in its header, and I must change their text sometimes, in service there is some data that i need On first run everything is perfect, but when I go to the first activity from second, I have nullpointerexception in textviews. What causes it, and how to fix? //First @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /

Cannot resolve method getActivity()

我只是一个虾纸丫 提交于 2019-11-30 17:12:12
I am new to Android and learning to create fragments in Android by following this example: Fragment Navigation Drawer The code between Navigating between Menu Items and Add Navigation Header consists a method getActivity() . As the author didn't mentioned where to paste this code, I pasted in my MainActivity.java file Is code between Navigating between Menu Items and Add Navigation Header pasted at correct location by me? In method selectDrawerItem(MenuItem menuItem) there is a comment // Create a new fragment and specify the planet to show based on position Does author expects me to add

fitsSystemWindows on Fragment, Activity and DrawerLayout combination

浪尽此生 提交于 2019-11-30 16:05:43
Problem The activity layout has a DrawerLayout with a FrameLayout as content to Fragment and a LinearLayout to be opened and closed by drawer. The fragment used on content has a FrameLayout with fitsSystemWindows flag and a Toolbar . If I insert the fragment at onCreate() all occurs as expected, the FrameLayout starts on position 0 and the Toolbar starts below the statusbar. But outside the onCreate() the same code fails, the fitsSystemWindows not works with FrameLayout . An important point, I need the Toolbar and fitsSystemWindows flag on Fragment and not on Activity . How to get the same

Android parent Navigation Drawer for all activities

こ雲淡風輕ζ 提交于 2019-11-30 16:00:46
I am creating an app which requires same Navigation Drawer for all activities. To do so, I have created a class which extends Activity (need for child classes) and written the code for Navigation Drawer there. public class NavigationDrawerClass extends Activity { String [] names = new String[]{"Rohan", "Muthu","Rishi"}; private ActionBarDrawerToggle mDrawerToggle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.navigation_drawer_class); DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ListView