android-navigation

How to detect if navigation drawer is open?

泄露秘密 提交于 2019-11-30 10:24:07
问题 The title explains it all. All what I want to do is to know if the navigation drawer is open or not. I searched a lot on the net and found the method isDrawerOpen(int drawerGravity) but couldn't find a satisfactory answer which explains how to use it in a method. I would appreciate if anyone explains it to me. Thanks in advance! 回答1: Assuming you have defined a drawerlayout in xml: DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ... if(mDrawerLayout.isDrawerOpen

Android Navigation Component pop to transition issue

我是研究僧i 提交于 2019-11-30 09:15:56
I have 2 actions Action1 <action android:id="@+id/actionBaseFragmentToAskForLocation" app:destination="@+id/introAskForLocationFragment" app:enterAnim="@anim/slide_in_right" app:exitAnim="@anim/slide_out_left" app:popEnterAnim="@anim/slide_in_left" app:popExitAnim="@anim/slide_out_right" /> Action2 <action android:id="@+id/actionIntroAskLocationToLogin" app:destination="@id/loginFragment" app:enterAnim="@anim/slide_in_right" app:exitAnim="@anim/slide_out_left" app:popEnterAnim="@anim/slide_in_right" app:popExitAnim="@anim/fade_out" app:popUpTo="@+id/app_main_navigation" /> What i want is when

How do I add navigation drawer to my existing code?

二次信任 提交于 2019-11-30 09:00:24
问题 I have an app in which I have a navigation panel with menu buttons on which I want to apply navigation drawer, currently it takes up the entire screen,but I want to restrict it to 3/4th of the screen by applying navigation drawer on it, but i have never touched navigation drawer before so have no clue, any help or guidance will be great.Also went through some documentation and got confused :( Here is my code: and here is my layout class for navigation panel: <?xml version="1.0" encoding="utf

Tool bar setNavigationOnClickListener breaks ActionbarDrawerToggle functionality

霸气de小男生 提交于 2019-11-30 06:59:42
问题 I'm swapping out the action bar for the tool bar, and I nearly have every piece of the puzzle in place. My issue is specifically if I navigate 'up' and restore the navigation drawer, the drawer toggle button no longer works. I figured out if I set the drawer mode to unlocked I have the ability to swipe to open the drawer, but can't click to open the drawer. So I load fragment A, drawer behaviour is fine, go down to fragment B and apply the up icon, hit up to go back to A, and the drawer won't

Calculating Speed for a navigation app without getSpeed() method

无人久伴 提交于 2019-11-30 04:25:23
I am developing an app which is more of a time-shift racing between your friends. I need to calculate speed of a moving vehicle, and I don't want to use Location.getSpeed() method. (Explained in detail in the bottom why I don't want to use it) I am trying to calculate speed with the help of Latitude and Longitude available to me, and this is where I need help. The help needed: I would want to know is: If the algorithm is correct Should I calculate in Centimeters instead of meters And if there's any code/library already available which does it. I am using the following code: This gives me

Android Jetpack Navigation with ViewPager and TabLayout

荒凉一梦 提交于 2019-11-30 02:20:14
For a new app i use Jetpack Navigation Library to implement proper back navigation. The first level of navigation is a navigation drawer which works fine with jetpack navigation as described in the documentation. But there is another level of navigation implemented with ViewPager and TabLayout. The fragments switched by the TabLayout contain additional linear navigation hierarchy. However, there seems to be no support for ViewPager/TabLayout in Jetpack Navigation. A FragmentPagerAdapter has to be implemented and the managed back stack ends when switching tabs. There is a disconnect between the

How to detect if navigation drawer is open?

风流意气都作罢 提交于 2019-11-29 20:13:54
The title explains it all. All what I want to do is to know if the navigation drawer is open or not. I searched a lot on the net and found the method isDrawerOpen(int drawerGravity) but couldn't find a satisfactory answer which explains how to use it in a method. I would appreciate if anyone explains it to me. Thanks in advance! Assuming you have defined a drawerlayout in xml: DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ... if(mDrawerLayout.isDrawerOpen(GravityCompat.START)) { //drawer is open } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

Android Jetpack Navigation, BottomNavigationView with Youtube or Instagram like proper back navigation (fragment back stack)?

偶尔善良 提交于 2019-11-29 19:40:46
Android Jetpack Navigation, BottomNavigationView with auto fragment back stack on back button click? What I wanted, after choosing multiple tabs one after another by user and user click on back button app must redirect to the last page he/she opened. I achieved the same using Android ViewPager, by saving the currently selected item in an ArrayList. Is there any auto back stack after Android Jetpack Navigation Release? I want to achieve it using navigation graph activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas

Listview containing checkbox and text is getting reset on scrolling

倖福魔咒の 提交于 2019-11-29 18:16:15
I have drawn a customized navigation drawer with ListView and header but when i scroll the List the checkbox in the List are getting unchecked. Secondly when i click on the reset button in the header part I want that all the checkbox in the Listview should get get unchecked. I have been trying this to get it working but unable to find any solution.. The snippets are public class NavigationDrawer extends Fragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.filter_navigation_drawer, container

How to Call FrameLayout slider in Different Activities in Android

≡放荡痞女 提交于 2019-11-29 18:05:19
I have 3 activity say first_activity , second_activity , third_activity .I have used FrameLayout to open a slider .! Now what I want to open the slider on click of button that is available on all three activities. So now like in the Test 1 there is a button on the left side in the same way i have on all three activities so on click of that i want to open the slider. This my slider code public class MainActivity extends Activity { // Within which the entire activity is enclosed private DrawerLayout mDrawerLayout; // ListView represents Navigation Drawer private ListView mDrawerList; //