Created
July 21, 2019 20:09
-
-
Save B0yma/195978ad931bcdaba83016c2f39ebc83 to your computer and use it in GitHub Desktop.
CollapseAppBar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BindingAdapters { | |
@BindingAdapter({"app:setFlags"}) | |
public static void setFlags(CollapsingToolbarLayout view, int flag) { | |
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) view.getLayoutParams(); | |
params.setScrollFlags(flag); | |
view.setLayoutParams(params); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
private void setNormalMode() { | |
collapseMode.set(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL|AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.design.widget.CollapsingToolbarLayout | |
... | |
app:setFlags="@{viewModel.collapseMode}" | |
...> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment