小吃店堆栈将始终仅显示最后一个小吃店 [英] Snackbar stack will always show only the last snackbar
问题描述
Snackbar.make(...).show()
将仅显示最后一个小吃条,而与其他小吃条消失的烤面包不同.
The Snackbar.make(...).show()
will only show the last snackbar unlike toast the other snackbars are gone.
for(int i = 1;i < 11;i++) {
Snackbar.make(..., "number: " + i, Snackbar.LENGTH_SHORT).show();
}
有时候,小吃栏应在网络任务之后显示,而小吃条应该在网络任务之前显示,秒小吃条从不显示.
Sometimes when the snackbar should show after network task and one should show before network task, the seconds snackbar is never shown.
我正在使用coordinatorlayout.
Im using a coordinatorlayout.
推荐答案
请参考Android组件文档:
Please refer the Android components docs:
小吃栏自动从屏幕超时.出于可用性的原因,小吃店不应仅包含访问核心用例的唯一方法.它们不应是持久的或堆叠的,因为它们位于屏幕上其他元素的上方(
Snackbars automatically time out from the screen. For usability reasons, snackbars should not contain the only way to access a core use case. They should not be persistent or be stacked, as they are above other elements on screen (Source)
这篇关于小吃店堆栈将始终仅显示最后一个小吃店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!