【发布时间】:2015-03-06 07:46:07
【问题描述】:
所以我使用https://github.com/neokree/MaterialNavigationDrawer 作为我的导航抽屉和https://gist.github.com/Jogan/9def6110edf3247825c9 作为我的FAB 实现。当我打开导航抽屉时,它没有覆盖 FAB,并且按钮出现在它的顶部。我想避免隐藏按钮并在抽屉打开/关闭时显示它,因为这会分散注意力。有想法该怎么解决这个吗?
编辑: 我正在以编程方式添加 FAB:
fabButton = new FloatingActionButton.Builder(this)
.withDrawable(getResources().getDrawable(R.drawable.ic_action_edit))
.withButtonColor(0xFF2196F3)
.withGravity(Gravity.BOTTOM | Gravity.END)
.withMargins(0, 0, 16, 16)
.create();
将该声明更改为片段并不能修复它。我在上面链接的导航栏实现需要从 MaterialNavigationDrawer 类扩展的活动,该类可能首先绘制导航抽屉,而按钮始终位于最后。有没有办法以编程方式强制元素排序?
【问题讨论】:
标签: android navigation-drawer material-design floating-action-button