navigation-drawer

Error incompatible types: android.app.FragmentManager cannot be converted to android.support.v4.app.FragmentManager

落爺英雄遲暮 提交于 2019-12-20 01:09:12
问题 Error Error incompatible types: android.app.FragmentManager cannot be converted to android.support.v4.app.FragmentManager is drving me nuts. In my app, I have 3 navigation drawer item, timesheet , claim and view , created in MainActivity. Now I wanted to add two tabs with swipe view in view item. MainActivity // for navigation drawer import android.app.Fragment; import android.app.FragmentManager; private void selectItem(int position) { Fragment fragment = null; switch (position) { case 0:

How to Have Navigation Drawer setup with Navigation Controller and handle individual Menu Items

余生颓废 提交于 2019-12-19 10:19:12
问题 I would like to have most of menu item handled by Navigation Component's controller, but I also want to handle one "Log out" menu item individually like this: val navController = findNavController(R.id.nav_host_fragment) nav_view.setNavigationItemSelectedListener { item -> when(item.itemId) { R.id.logout_menu_item -> { Toast.makeText(context, "Logut Menu Item Touched", Toast.LENGTH_LONG).show() true } else -> false } } nav_view.setupWithNavController(navController) bottom_navigation

Navigation Drawer - Divider between sections like Gmail App

百般思念 提交于 2019-12-19 04:47:28
问题 I am updating the Navigation Drawer in my app. I want to add section dividers as the Gmail App has. How do I add them? Just add them as views, which is a simple approach. But, i want to know, is it the correct approach? Gmail App: Right now, I am using a listview with a header view. My current xml: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match

Android Status Bar transparent with Navigation Drawer - Appbar elevation

风流意气都作罢 提交于 2019-12-19 04:21:44
问题 I am working on an app with Material Design Guidelines. I have a boilerplate app created by Android Studio. For some reason the status bar has a little gradient at the bottom which creates an illusion of Appbar (Toolbar) being on a higher elevation than status bar. I took a look on Chris Bane's Cheesesquare app for reference and it doesn't look like he is doing anything special to achieve that. Here are the screenshots for reference - Boilerplate app Cheesesquare app Notice that Cheesesquare

Change ActionBarDrawerToggle icon android in toolbar?

[亡魂溺海] 提交于 2019-12-18 20:47:55
问题 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);

fitsSystemWindows on Fragment, Activity and DrawerLayout combination

守給你的承諾、 提交于 2019-12-18 18:24:11
问题 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,

Transition in navigation drawer android

☆樱花仙子☆ 提交于 2019-12-18 16:49:29
问题 Anyone having idea that how to achieve this type of transition. When we open Navagation drawer full screen is getting animation like this. I also looked at reside menu but here menu is predefined not as i want. I also tried with NavigationDrawer but not got succeed. drawer.addDrawerListener(new DrawerLayout.DrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { float moveFactor = (linearLayout.getWidth() * slideOffset); float min = 0.9f; float max = 1.0f;

Unable to add Tabs inside Fragment of Navigation Drawer Android

为君一笑 提交于 2019-12-18 15:51:02
问题 1) I have followed the Navigation Drawer example in Android Developer Docs here developer.android.com/training/implementing-navigation/nav-drawer.html and created my whole application. In the given example, they have used Fragments for each item selected in the Drawer called fragments with following code Bundle args = new Bundle(); args.putInt("Title_Number", position); fragment.setArguments(args); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction()

Unable to add Tabs inside Fragment of Navigation Drawer Android

别说谁变了你拦得住时间么 提交于 2019-12-18 15:50:44
问题 1) I have followed the Navigation Drawer example in Android Developer Docs here developer.android.com/training/implementing-navigation/nav-drawer.html and created my whole application. In the given example, they have used Fragments for each item selected in the Drawer called fragments with following code Bundle args = new Bundle(); args.putInt("Title_Number", position); fragment.setArguments(args); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction()

Android Navigation Drawer Doesn't Pass onTouchEvent to Activity

北城以北 提交于 2019-12-18 15:49:18
问题 I have an Activity which uses the Android NavigationDrawer . When using only fragment s (as usual), everything works perfect. But now I want to use this drawer on other activities of my app, and for some of them, I don't want the main view to be a fragment . Question The problem is, the onTouchEvent() of the activity itself (and the onItemClickedListener() of a child ListView for that matter) isn't called, because the drawer consumes it. Of course, I want it to be called:) Needless to say, I