diff --git a/lib/java/com/google/android/material/appbar/AppBarLayout.java b/lib/java/com/google/android/material/appbar/AppBarLayout.java index f775bb5f4f0..da4e04e62de 100644 --- a/lib/java/com/google/android/material/appbar/AppBarLayout.java +++ b/lib/java/com/google/android/material/appbar/AppBarLayout.java @@ -967,6 +967,19 @@ public boolean isLiftOnScroll() { return liftOnScroll; } + /** + * Sets the view that the {@link AppBarLayout} should use to determine whether it should be + * lifted. + */ + public void setLiftOnScrollTargetView(@Nullable View liftOnScrollTargetView) { + this.liftOnScrollTargetViewId = View.NO_ID; + if (liftOnScrollTargetView == null) { + clearLiftOnScrollTargetView(); + } else { + this.liftOnScrollTargetView = new WeakReference<>(liftOnScrollTargetView); + } + } + /** * Sets the id of the view that the {@link AppBarLayout} should use to determine whether it should * be lifted.