android-navigation

how to remove default animation transition when using navigation component in Android?

孤街醉人 提交于 2020-01-15 09:14:33
问题 I am using Navigation component, and I have a bottom navigation view in the main activity. when I tap the tab in that bottom navigation view, it seems that there is a fade in animation when the fragment appear. I don't think I manually set the animation, it seems that the animation will be there by default. I want to remove that animation. here is the code I use in my Main Activity. class MainActivity : AppCompatActivity(), NavController.OnDestinationChangedListener { private lateinit var

Android - Navigation drawer fragments

こ雲淡風輕ζ 提交于 2020-01-11 03:52:05
问题 I have implemented navigation drawer in my android app. but now I want to be able to change the layout using fragments when the user clicks any list item in the navigation bar. Here is what I have got so far: XML <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:id="@+id/content_frame"

Android Navigation draw re-loading fragment whenever closed

这一生的挚爱 提交于 2020-01-06 06:54:13
问题 I am trying to convert all my code from activities to fragments in order to use a navigation drawer and eventualy some sliding tabs. Currently I have a semi working navigation drawer that opens and displays a list. BUt I am new to fragments and am confused because it seems to reload my first fragment everytime I close the navigation drawer and do not select anything. MainDrawer.java : package com.beerportfolio.beerportfoliopro; import android.support.v4.app.Fragment; import android.os.Bundle;

Hide Toolbar back arrow with NavigationComponent and BottomNavigationView

北城余情 提交于 2020-01-06 06:46:45
问题 I'm in the process of implementing NavigationComponent coupled with a BottomNavigationView and I am noticing that the back arrow is shown in the toolbar for all fragment destinations except the one specified as the startDestination in my navigation graph. All examples of this implementation that I've been able to find show similar behavior. Hiding the back arrow for each associated fragment of a BottomNavigationView seems like a more natural design in my opinion, (hitting a back arrow in the

Fragments are not loaded from Navigation Drawer Click Listener

不羁的心 提交于 2020-01-05 09:30:15
问题 Android OnItemClickListener is not working. I have already researched some of the previous similar questions I could not find any solution to my problem. I find Log.d("TAG", "Item Click Working"); in the Logcat but I am not able to open a new fragment. I am attaching the code below. **MainActivity** import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.json.JSONException; import org.json.JSONObject; import android

android.support.v7 Toolbar & DrawerLayout- how to change Hamburger icon

陌路散爱 提交于 2020-01-05 03:52:05
问题 My application uses ActionBarActivity and DrawerLayout and etc. i want to change the ActionBarDrawerToggle icon to be custom drawable. in my code i use android.support.v7.widget.Toolbar as SupportActionBar this is my code: toolbar.setNavigationIcon(R.drawable.lifeline_shield); setSupportActionBar(toolbar); ActionBar actionbar = getSupportActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setDisplayShowTitleEnabled(false); mDrawerToggle = new ActionBarDrawerToggle(this,

Fragment savedInstanceState is always null when using Navigation Component

感情迁移 提交于 2020-01-03 17:13:09
问题 Currently, I am playing around Android Navigation Component with Bottom Navigation Bar. While playing I realized two facts: Fragments are always recreated ( onCreate , onViewCreated , onViewDestroyed are called as soon as the user navigates to another fragment) savedInstanceState is always null (in onCreate , onViewCreated , etc.) The first issue can be fixed by using custom FragmentNavigator , which will reuse fragment if it already exists package am.chamich.apps.advancedbottomnavigation

Fragment savedInstanceState is always null when using Navigation Component

时间秒杀一切 提交于 2020-01-03 17:12:43
问题 Currently, I am playing around Android Navigation Component with Bottom Navigation Bar. While playing I realized two facts: Fragments are always recreated ( onCreate , onViewCreated , onViewDestroyed are called as soon as the user navigates to another fragment) savedInstanceState is always null (in onCreate , onViewCreated , etc.) The first issue can be fixed by using custom FragmentNavigator , which will reuse fragment if it already exists package am.chamich.apps.advancedbottomnavigation

How to prevent previous fragment to show up after pressing back button using navigation controller?

馋奶兔 提交于 2019-12-31 01:49:13
问题 I am trying to use the navigation controller right now. I want to move from LoginFragment to HomeFragment . In LoginFragment I use this code below to move to HomeFragment . Navigation.findNavController(view).navigate(homeDestination) However, when I tap the back button in the HomeFragment , it will go back to LoginFragment , I expect that when I tap the button it will close the app. In old way, if I use activity instead of using Fragment , I usually do something like this to get that expected

2 ViewPager not scrolling in Android 2.3

霸气de小男生 提交于 2019-12-30 08:19:24
问题 I am using Navigation Drawer in my app, that contains some Fragments just like in the below picture. Every Fragment Contains another ViewPager that is an ImageSlider, and below that is a Listview and at the top I am using the SwipeRefreshLayout. My problem is the image slider works well on devices that has Android version 3.0 or higher but the swipe left or right doesn't works on devices 2.3 and lower, instead it invokes the Parent ViewPager's swipe that is it navigates the fragment. I am