material-components-android
material-components-android copied to clipboard
[TopAppBar] Make compress effect flag available via setScrollEffect
trafficstars
Is your feature request related to a problem? Yes, this feature request is related to issue #2887
Describe the solution you'd like
- For
com.google.android.material.appbar.MaterialToolbarandandroidx.appcompat.widget.Toolbar, a compress effect can be added to the toolbar title in XML by usingapp:layout_scrollEffect="compress". - 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 flagSCROLL_EFFECT_COMPRESSdeclared inAppBarLayoutclass is not publicly accessible and can therefore not be set. - Currently, a globally set compress effect can just be unset if null is passed to
setScrollEffectbut not the other way round. - Therefore, it would be great to have a possiblity to set the scroll effect "compress" programmatically via
setScrollEffectby using theSCROLL_EFFECT_COMPRESSflag.