我最近开始了解构建版本为 22.2.0 的 android 支持设计库。在这一点上,大多数易于使用的自定义 View 给我留下了深刻的印象。但是,考虑到这些问题的定制,我完全坚持这些解决方案。 SnackBar 是我最纠结的主要部分之一。
我正在使用以下代码在我的Activity 中显示SnackBar:
Snackbar.make (view,"Success",Snackbar.LENGTH_SHORT).show ();
Gradle 构建库:
compile 'com.android.support:design:22.2.0'
一切都很棒,但我需要的是从上到下显示 snackbar 而不是默认的 bottom to top 属性。请任何人帮助您解决问题。提前致谢
最佳答案
根据文档:
Snackbars provide lightweight feedback about an operation. They show a brief message at the bottom of the screen on mobile and lower left on larger devices. Snackbars appear above all other elements on screen and only one can be displayed at a time.
我现在无法查看 Snackbar 源代码,但也许您可以尝试扩展 Snackbar 类并覆盖 show() 方法或其他方法以满足您的需要。
关于android - 如何更改snackbar的属性以在android支持设计库中从上到下显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30680316/