You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a CoordinatorLayout with an AppBarLayout and a NestedScrollView. In the NestedScrollView, I have a horizontally scrolling RecyclerView surrounded by two dummy Views.
I have set liftOnScroll="true" and it is working when I scroll on dummy Views in the NestedScrollView, But when I vertically scroll on top of the horizontal RecyclerView, while the NestedScrollView correctly scrolls vertically, the AppBarLayout seems not to detect it, and does not update its lifted state. When I fling on top of the RecyclerView with a lot of velocity, it seems to work correctly most of the time. However it never works correctly when slowly dragging on top of the RecyclerView.
Expected behavior:
The liftOnScroll should update the AppBarLayout when the NestedScrollView is scrolled, no matter where exactly the vertical scroll gesture was started inside of the NestedScrollView.
public class StatsAdapter extends RecyclerView.Adapter<StatsAdapter.ViewHolder> {
public StatsAdapter() {}
public static class ViewHolder extends RecyclerView.ViewHolder {
public TextView textViewCalc;
public ViewHolder(View itemView) {
super(itemView);
this.textViewCalc = itemView.findViewById(R.id.textViewCalc);
}
}
@Override
public StatsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem = layoutInflater.inflate(R.layout.stats_item, parent, false);
ViewHolder viewHolder = new ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.textViewCalc.setText(
position + " x " + position + "\n" + position + " x " + position + "\n" + position + " x " + position
);
}
@Override
public int getItemCount() {
return 9;
}
}
Description:
I have a
CoordinatorLayout
with anAppBarLayout
and aNestedScrollView
. In theNestedScrollView
, I have a horizontally scrollingRecyclerView
surrounded by two dummyView
s.I have set
liftOnScroll="true"
and it is working when I scroll on dummyView
s in theNestedScrollView
, But when I vertically scroll on top of the horizontalRecyclerView
, while theNestedScrollView
correctly scrolls vertically, theAppBarLayout
seems not to detect it, and does not update its lifted state. When I fling on top of theRecyclerView
with a lot of velocity, it seems to work correctly most of the time. However it never works correctly when slowly dragging on top of theRecyclerView
.Expected behavior:
The
liftOnScroll
should update theAppBarLayout
when theNestedScrollView
is scrolled, no matter where exactly the vertical scroll gesture was started inside of theNestedScrollView
.Source code:
MainActivity.java
activity_main.xml
StatsAdapter.java
stats_item.xml
Minimal sample app repro:
https://github.com/BenjyTec/TopBarRepro
Android API version:
API35, but also reproduced back until API21.
Material Library version:
Issue reproduced on 1.12.0 and 1.13.0-alpha08
Device:
Google Pixel 4a, and Emulator
Attachments:
liftonscroll.mp4
The text was updated successfully, but these errors were encountered: