navigation-drawer

Avoid ViewPager going under Toolbar

半腔热情 提交于 2019-12-21 23:02:08
问题 Based on this answer I tried to make a solution for my Use Case. Instead of using a Collapsing toolbar I'm using a regular one but with a TabLayout . However, for the TabLayout I need to use a ViewPager and I have no idea where to place it in order to avoid trouble with the FrameLayout . ViewPager was in my Host Fragment and when its layout replaced the FrameLayout, the content went below the Toolbar and TabLayout for some reason... I tried putting it below that line <include layout="@layout

How to disable drawer option in specific fragments of an activity

独自空忆成欢 提交于 2019-12-21 21:34:38
问题 I have an activity with 5 fragments, I used drawer layout in my activity for a drawer, but I want to use(enable) the drawer in only fragment 2 and I want to disable the drawer option in remaining fragments. Can any one help me how to do this? 回答1: Put two methods in the your activity , one to disable the drawer and one to enable it again, like so: public void lockDrawer() { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } public void unlockDrawer() { drawerLayout

How to hide navigation drawer when opening certain fragment?

孤街醉人 提交于 2019-12-21 19:59:55
问题 I'm pretty new in android development. I want to hide navigation drawer when user is not logged in. So basically, it will shown login fragment (better in full screen like Facebook android). And if user already logged in, navigation drawer will always shown. MainActivity.java public class MainActivity extends AppCompatActivity { private DrawerLayout navDrawerLayout; private Toolbar toolbar; private ActionBarDrawerToggle navDrawerToggle; private SharedPreferences pref; @Override protected void

Navigation Drawer not working on pre-ICS versions

一世执手 提交于 2019-12-21 05:22:00
问题 I have implemented Navigation Drawer based on a ListView. It works perfectly fine with ICS and above versions of Android. However, on older versions, it crashes with this error: 06-23 15:50:11.570: E/AndroidRuntime(403): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/list_selector_background.xml from xml type drawable resource ID #0x0 I have tried copying this particular xml file from Android sdk to my own project, but that didn't help. Here's the xml file

Navigation Drawer: Add Titles to Groups, Not Items

自闭症网瘾萝莉.ら 提交于 2019-12-21 03:41:33
问题 I have a standard Navigation Drawer, pre-created by Android Studio and want to populate it with number of groups. I started with this: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item android:id="@+id/nav_mode_person" android:icon="@drawable/ic_person_black_24dp" android:title="Person" /> <item android:id="@+id/nav_mode_group" android:icon="@drawable/ic_group_black_24dp" android:title=

How to open NavigationDrawer only on first app start?

帅比萌擦擦* 提交于 2019-12-21 02:07:09
问题 Per Google guidelines, it is recommended you open the DrawerLayout the first time only after app is installed and opened (to show user the functionality). How would you go about doing this? It seems it would be a combination of openDrawer() method with some type of preference. 回答1: I would recommend that you use the SharedPreferences for that: The basic idea is that you read the SharedPreferences and look for a boolean value that doesn't exist there at first app start. By default, you will

Xamarin.Forms MissingMethodException: 'Android.Support.V4.Widget.DrawerLayout.AddDrawerListener' not found

两盒软妹~` 提交于 2019-12-20 23:27:36
问题 I have followed everything from the following link: https://developer.xamarin.com/guides/xamarin-forms/user-interface/navigation/master-detail-page/ The code I wrote can be found here: http://github.com/foyzulkarim/XamarinFormsDrawer I successfully deployed the same project in my Windows 10 Local machine using UWP project, but whenever I want to deploy in Emulator, or in my device, it is throwing the following exception. System.MissingMethodException: Method 'Android.Support.V4.Widget

Hamburger Icon does not show in Navigation Drawer Fragment

一世执手 提交于 2019-12-20 20:40:57
问题 I am using a Fragement for navigation drawer and hence can't use onPostCreated to call syncState public class NavigationDrawerFragment extends Fragment{ .... Calling syncState() on activityCreated @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Indicate that this fragment would like to influence the set of actions in the action bar. setHasOptionsMenu(true); mDrawerToggle.syncState(); } Using the ic_drawer for icon public

Android, slidingpanelayout vs navigationDrawer

百般思念 提交于 2019-12-20 20:02:55
问题 I'm about to use one of them and yet i'm very confused. I don't know the difference. to me, both look the same. I've passed through this Difference between SlidingPaneLayout and NavigationDrawer may anyone tell the difference between them?? 回答1: This is what the official Navigation Drawer (DrawerLayout) looks like: And this is what the SlidingPaneLayout looks like: Both serve different purposes. The DrawerLayout serves as a menu, to put it simple. The SlidingPaneLayout on the other hand is a

Android, slidingpanelayout vs navigationDrawer

社会主义新天地 提交于 2019-12-20 20:01:46
问题 I'm about to use one of them and yet i'm very confused. I don't know the difference. to me, both look the same. I've passed through this Difference between SlidingPaneLayout and NavigationDrawer may anyone tell the difference between them?? 回答1: This is what the official Navigation Drawer (DrawerLayout) looks like: And this is what the SlidingPaneLayout looks like: Both serve different purposes. The DrawerLayout serves as a menu, to put it simple. The SlidingPaneLayout on the other hand is a