gpt4 book ai didi

android - 如何以编程方式锁定展开/折叠 Action ?

转载 作者:太空宇宙 更新时间:2023-11-03 11:30:43 25 4
gpt4 key购买 nike

我想在特定操作上保留此布局:

Initial layout

如今,我可以通过在其上执行滑动来折叠或展开此 CoordinatorLayout。我想阻止这种行为。

最佳答案

我假设您的列表使用的是 RecyclerView

您可以在 RecyclerView 上关闭嵌套滚动,这将禁用工具栏折叠:

recyclerView.setNestedScrollingEnabled(false);

您可以通过清除滚动标志来锁定工具栏:

CollapsingToolbarLayout toolbar = findViewById(R.id.collapsingToolbar);  // or however you need to do it for your code
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
params.setScrollFlags(0); // clear all scroll flags

关于android - 如何以编程方式锁定展开/折叠 Action ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36198907/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com