material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[TopAppBar] Make compress effect flag available via setScrollEffect

Open patrickfrei opened this issue 3 years ago • 0 comments
trafficstars

Is your feature request related to a problem? Yes, this feature request is related to issue #2887

Describe the solution you'd like

  1. For com.google.android.material.appbar.MaterialToolbar and androidx.appcompat.widget.Toolbar, a compress effect can be added to the toolbar title in XML by using app:layout_scrollEffect="compress".
  2. However, trying to programmatically set that scroll effect (e.g. for certain API levels only) by using setScrollEffect (see documentation) isn't possible. Reason: The scroll effect flag SCROLL_EFFECT_COMPRESS declared in AppBarLayout class is not publicly accessible and can therefore not be set.
  3. Currently, a globally set compress effect can just be unset if null is passed to setScrollEffect but not the other way round.
  4. Therefore, it would be great to have a possiblity to set the scroll effect "compress" programmatically via setScrollEffect by using the SCROLL_EFFECT_COMPRESS flag.

patrickfrei avatar Aug 04 '22 15:08 patrickfrei