J'ai un CoordinatorLayout
qui contient AppBarLayout
et un FrameLayout
qui contient des fragments.
L'un de ces fragments contient un TabLayout
en haut, un élément de liste RecyclerView
et en bas un "barre d'outils faite maison".
Le AppBarLayout
est configuré avec app:layout_scrollFlags="scroll|enterAlways"
Mon problème est que les deux "barres d'outils" se cachent lors du défilement, AppBarLayout et ma barre d'outils "maison" en bas. C'est le comportement actuel
Je voudrais corriger la barre d'outils "maison" en bas pour rester visible, mais je ne peux pas l'atteindre.
C'est le XML du fragment Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:orientation="vertical"
>
<Android.support.design.widget.TabLayout
Android:id="@+id/toolbarfilter"
Android:layout_width="match_parent"
Android:background="@color/azul_asde"
app:tabMode="fixed"
app:tabMaxWidth="0dp"
Android:elevation="4dp"
app:tabIndicatorColor="@color/verde_pastel"
Android:layout_height="wrap_content"
/>
<Android.support.v4.widget.SwipeRefreshLayout
xmlns:Android="http://schemas.Android.com/apk/res/Android"
Android:id="@+id/swipeContainer"
Android:layout_width="match_parent"
Android:layout_height="0dp"
Android:layout_weight="1">
<Android.support.v7.widget.RecyclerView
Android:id="@+id/list"
Android:layout_width="match_parent"
Android:layout_height="match_parent"/>
</Android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
Android:id="@+id/toolbarselection"
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:orientation="horizontal"
Android:paddingTop="10dp"
Android:paddingBottom="10dp"
Android:background="@color/azul_asde"
Android:elevation="4dp"
Android:visibility="visible"
>
<ImageView
Android:id="@+id/delete"
Android:layout_width="0dp"
Android:layout_height="wrap_content"
Android:layout_weight="1"
Android:src="@drawable/ic_delete_white_24dp"
Android:tint="@color/gris_desactivado" />
<ImageView
Android:id="@+id/select"
Android:layout_width="0dp"
Android:layout_height="wrap_content"
Android:layout_weight="1"
Android:src="@drawable/ic_bookmark_border_white_24dp"/>
<ImageView
Android:id="@+id/send"
Android:layout_width="0dp"
Android:layout_height="wrap_content"
Android:layout_weight="1"
Android:src="@drawable/ic_send_white_24dp"
Android:tint="@color/gris_desactivado" />
</LinearLayout>
</LinearLayout>
EDIT1: CECI les questions semblent être le même problème.
Essayez cette disposition:
<?xml version="1.0" encoding="utf-8"?>
<Android.support.design.widget.CoordinatorLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
xmlns:tools="http://schemas.Android.com/tools"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:id="@+id/container">
<ScrollView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:layout_above="@+id/bottom_navigation"
Android:layout_alignParentTop="true">
<LinearLayout
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:orientation="vertical">
<Android.support.v7.widget.CardView
xmlns:card_view="http://schemas.Android.com/apk/res-auto"
Android:id="@+id/card_view"
Android:layout_width="match_parent"
Android:layout_margin="10dp"
Android:layout_height="110dp"
Android:padding="15dp"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="4dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:text="Test" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
xmlns:card_view="http://schemas.Android.com/apk/res-auto"
Android:id="@+id/card_view1"
Android:layout_width="match_parent"
Android:layout_margin="10dp"
Android:layout_height="110dp"
Android:padding="15dp"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="4dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:text="Test" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
xmlns:card_view="http://schemas.Android.com/apk/res-auto"
Android:id="@+id/card_view3"
Android:layout_width="match_parent"
Android:layout_margin="10dp"
Android:layout_height="110dp"
Android:padding="15dp"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="4dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:text="Test" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
xmlns:card_view="http://schemas.Android.com/apk/res-auto"
Android:id="@+id/card_view4"
Android:layout_width="match_parent"
Android:layout_margin="10dp"
Android:layout_height="110dp"
Android:padding="15dp"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="4dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:text="Test" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
xmlns:card_view="http://schemas.Android.com/apk/res-auto"
Android:id="@+id/card_view5"
Android:layout_width="match_parent"
Android:layout_margin="10dp"
Android:layout_height="110dp"
Android:padding="15dp"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="4dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:text="Test" />
</Android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
<RelativeLayout
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:layout_gravity="bottom"
Android:gravity="bottom">
<Android.support.design.widget.BottomNavigationView
Android:layout_width="match_parent"
Android:layout_height="56dp"
Android:layout_weight="1"
Android:foregroundGravity="bottom"
Android:background="@color/green"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
Android:id="@+id/bottomnav"
app:menu="@menu/main">
</Android.support.design.widget.BottomNavigationView>
</RelativeLayout>
</Android.support.design.widget.CoordinatorLayout>
essaye ça
<?xml version="1.0" encoding="utf-8"?>
<Android.support.design.widget.CoordinatorLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
xmlns:tools="http://schemas.Android.com/tools"
Android:id="@+id/container"
Android:layout_width="match_parent"
Android:layout_height="match_parent">
<ScrollView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:layout_above="@+id/bottom_navigation"
Android:layout_alignParentTop="true">
<LinearLayout
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:orientation="vertical">
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/red"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/red"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/red"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/red"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/red"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/red"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
<Android.support.v7.widget.CardView
Android:layout_width="match_parent"
Android:layout_height="50dp"
Android:padding="15dp"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="4dp"
app:cardElevation="2dp">
<TextView
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:gravity="center"
Android:text="Nilesh Rathod"
Android:textColor="#ffFFff" />
</Android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
<RelativeLayout
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:layout_gravity="bottom"
Android:gravity="bottom">
<Android.support.design.widget.BottomNavigationView
Android:id="@+id/bottomnav"
Android:layout_width="match_parent"
Android:layout_height="56dp"
Android:layout_weight="1"
Android:background="@color/green"
Android:foregroundGravity="bottom"
app:itemIconTint="@color/lightWhite"
app:itemTextColor="@color/lightWhite"
app:menu="@menu/menu"/>
</RelativeLayout>
</Android.support.design.widget.CoordinatorLayout>
Résultat
Vous pouvez essayer d'ajouter la barre d'outils collapseMode on yout à quelque chose comme ceci.
Votre appBarLayout semble bien
Je vous conseillerais de regarder ce lien: https://github.com/codepath/Android_guides/wiki/Handling-Scrolls-with-CoordinatorLayout `
<Android.support.design.widget.CollapsingToolbarLayout
Android:id="@+id/collapsing_toolbar"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:background="@Android:color/holo_blue_light"
Android:fitsSystemWindows="true"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<Android.support.v7.widget.Toolbar
Android:id="@+id/toolbar"
Android:layout_width="match_parent"
app:layout_collapseMode="pin"
Android:layout_height="?attr/actionBarSize"
Android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"/>
<Android.support.design.widget.TabLayout
Android:id="@+id/tablayout"
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
app:tabIndicatorColor="@color/white"
app:tabIndicatorHeight="@dimen/profile_tablayout_indicator_height"
Android:background="?attr/colorPrimary"
app:tabGravity="fill"/>
</Android.support.design.widget.CollapsingToolbarLayout>
Vous ne pouvez pas le faire dans coordinatorlayout. alors utilisez RelativeLayout et dans sa conception, votre propre mise en page
Pour corriger la barre du bas, vous devez d’abord utiliser une activité contenant des onglets. Dans cette activité, utilisez différents fragments. Ajoutez votre tabLayout à ce activity_main_tab.xml
activity_main_tab.xml
<?xml version="1.0" encoding="utf-8"?>
<Android.support.design.widget.CoordinatorLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:tools="http://schemas.Android.com/tools"
xmlns:local="http://schemas.Android.com/apk/res-auto"
Android:id="@+id/co_activity_root_layout"
Android:layout_width="match_parent"
Android:layout_height="match_parent">
<RelativeLayout
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:layout_alignParentTop="true">
<Android.support.design.widget.AppBarLayout
local:theme="@style/Theme.AppBarOverlay"
Android:id="@+id/toolbar_layout"
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:layout_alignParentTop="true">
</Android.support.design.widget.AppBarLayout>
<RelativeLayout
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:layout_below="@+id/toolbar_layout">
<FrameLayout
Android:id="@+id/fl_fragment_container"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
/>
</RelativeLayout>
</RelativeLayout>
</Android.support.design.widget.CoordinatorLayout>
Pour une utilisation fragmentée
fragment_tab.xml
utilisez ici app: layout_scrollFlags = "scroll | enterAlways" dans la barre d’outils pour le faire défiler
<?xml version="1.0" encoding="utf-8"?>
<Android.support.design.widget.CoordinatorLayout
xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
Android:id="@+id/coordinator"
Android:layout_width="match_parent"
Android:layout_height="match_parent">
<Android.support.design.widget.AppBarLayout
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:theme="@style/ThemeOverlay.AppCompat.Dark">
<Android.support.v7.widget.Toolbar
Android:id="@+id/toolbar"
Android:layout_width="match_parent"
Android:layout_height="?attr/actionBarSize"
Android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"/>
<Android.support.design.widget.TabLayout
Android:id="@+id/tablayout"
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
app:tabIndicatorColor="@color/white"
app:tabIndicatorHeight="@dimen/profile_tablayout_indicator_height"
Android:background="?attr/colorPrimary"
app:tabGravity="fill"/>
</Android.support.design.widget.AppBarLayout>
<Android.support.v4.view.ViewPager
Android:id="@+id/viewpager"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</Android.support.design.widget.CoordinatorLayout>
FragmentTabs.Java
public class FragmentTabs extends BaseFragment{
private View rootView;
private ViewPager viewPager;
private TabLayout tabLayout;
private Toolbar toolbar;
private ViewPagerAdapter viewPagerAdapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroupContainer, Bundle savedInstanceState) {
rootViewSearch = inflater.inflate(R.layout.fragment_tab, viewGroupContainer, false);
initializeLayout();
setUpActionBar();
setUpFragmentObjects();
return rootView;
}
private void initializeLayout() {
toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
tabLayout = (TabLayout) rootView.findViewById(R.id.tablayout);
}
private void setUpActionBar() {
getApplicationContext().setSupportActionBar(toolbarSearch);
ActionBar actionBar = getApplicationContext().getSupportActionBar();
if(actionBar != null){
actionBar.setTitle(Constants.BLANK);
}
}
private void setUpFragmentObjects() {
viewPagerAdapter = new ViewPagerAdapter(getApplicationContext(), getChildFragmentManager());
viewPager.setAdapter(searchViewPagerAdapter);
tabLayout.setupWithViewPager(viewPager);
}
}
ViewPagerAdapter.Java
public class ViewPagerAdapter extends FragmentPagerAdapter {
public ViewPagerAdapter(Activity activity, FragmentManager fragmentManager) {
super(fragmentManager);
}
@Override
public Fragment getItem(int position) {
Bundle bundle;
switch (position) {
case 0: // For Tab 1
// use fragment for tab 1
return fragment1;
case 1: // For Tab 2
// use fragment for tab 2
return fragment2;
case 2: // For Tab 3
// use fragment for tab 3
return fragment3;
default:
return null;
}
}
@Override
public int getCount() {
return 3; // no. of Tabs
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0: // Title For Tab1
return "Tab1";
case 1: // Title For Tab2
return "Tab2";
case 2: // Title For Tab3
return "Tab3";
default:
return null;
}
}
}
J'ai fait face au même problème Voici comment cela a fonctionné pour moi
Supprimer le AppBarLayout
layout_behavior
donc c'est fixé sur le dessus. Définissez le FrameLayout
layout_behavior comme app:layout_behavior="@string/appbar_scrolling_view_behavior"
donc il ajuste FrameLayout
en dessous de AppBarLayout
. De cette façon, le contenu de la structure du cadre défilera, mais pas la barre d’outils. CoordinatorLayout
mise en page comme suit
<?xml version="1.0" encoding="utf-8"?>
<Android.support.design.widget.CoordinatorLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
xmlns:tools="http://schemas.Android.com/tools"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:fitsSystemWindows="true"
tools:context="com.next_tech.teebox.GridView">
<Android.support.design.widget.AppBarLayout
Android:layout_width="match_parent"
Android:layout_height="wrap_content">
<Android.support.v7.widget.Toolbar
Android:id="@+id/toolbar"
Android:layout_width="match_parent"
Android:layout_height="?attr/actionBarSize"
Android:background="?attr/colorPrimary"
app:titleTextColor="@Android:color/white" />
</Android.support.design.widget.AppBarLayout>
<FrameLayout
Android:layout_width="match_parent"
Android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</Android.support.design.widget.CoordinatorLayout>
Ceci est le XML de la disposition de votre fragment où votre recyclerView
défile sans affecter votre disposition linéaire TabLayout
et inférieure.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:orientation="vertical"
>
<Android.support.design.widget.TabLayout
Android:id="@+id/toolbarfilter"
Android:layout_width="match_parent"
Android:background="@color/colorPrimary"
app:tabMode="fixed"
app:tabMaxWidth="0dp"
Android:elevation="4dp"
app:tabIndicatorColor="@color/btnBackground"
Android:layout_height="?android:actionBarSize"
/>
<Android.support.v4.widget.SwipeRefreshLayout
xmlns:Android="http://schemas.Android.com/apk/res/Android"
Android:id="@+id/swipeContainer"
Android:layout_width="match_parent"
Android:layout_height="0dp"
Android:layout_weight="1">
<Android.support.v7.widget.RecyclerView
Android:id="@+id/list"
Android:layout_width="match_parent"
Android:layout_height="match_parent"/>
</Android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
Android:id="@+id/toolbarselection"
Android:layout_width="match_parent"
Android:layout_height="?android:actionBarSize"
Android:orientation="horizontal"
Android:background="@color/colorPrimary"
Android:layout_gravity="bottom"
Android:elevation="4dp"
Android:visibility="visible"
>
<ImageView
Android:id="@+id/delete"
Android:layout_width="0dp"
Android:layout_height="wrap_content"
Android:layout_weight="1"
Android:layout_gravity="center"
app:srcCompat="@Android:drawable/ic_menu_delete" />
<ImageView
Android:id="@+id/select"
Android:layout_width="0dp"
Android:layout_height="wrap_content"
Android:layout_gravity="center"
Android:layout_weight="1"
app:srcCompat="@drawable/white_arrow" />
<ImageView
Android:id="@+id/send"
Android:layout_width="0dp"
Android:layout_height="wrap_content"
Android:layout_weight="1"
Android:layout_gravity="center"
app:srcCompat="@drawable/ic_send_holo_dark" />
</LinearLayout>
</LinearLayout>
J'espère que ça aide quelqu'un merci
pour plus d'informations - comportement de défilement pour les barres d'application sous Android
Ce comportement supprime essentiellement l'indicateur de défilement SCROLL
de AppBarLayout
, lorsque le contenu défilant dans la vue dépendante (RecyclerView
, NestedScrollView
) est inférieur à la hauteur de la vue, c'est-à-dire. lorsque le défilement n'est pas nécessaire. Elle annule également la vue de défilement décalée, qui est normalement effectuée par AppBarLayout.ScrollingViewBehavior
. Fonctionne bien lorsque vous ajoutez un pied de page, c.-à-d. dans la vue défilante ou dans ViewPager
, où la longueur du contenu peut être différente dans chaque page.
https://Gist.github.com/MaciejKaras/02bff315f00b87d80467a470424f22c
Déjà répondu à https://stackoverflow.com/a/37293634