简体   繁体   English

Android - 相对于滑动抽屉把手顶部定位布局项目

[英]Android - Positioning layout items relative to top of sliding drawer handle

I would like to position an element of an activity's layout relative to the top of a sliding drawer handle in its closed state.我想 position 活动布局的元素相对于其封闭的 state 中的滑动抽屉手柄的顶部。 The standard Layout above relative layout attribute obviously doesn't work given the floating nature of sliding drawer.考虑到滑动抽屉的浮动特性,相对布局属性Layout above显然不起作用。

It seems to me that the only (non-programmatic) alternative is to bottom-align and used fixed margins or bottom padding to ensure the element sits above the closed sliding drawer handle.在我看来,唯一(非编程)的替代方法是底部对齐并使用固定边距或底部填充来确保元素位于关闭的滑动抽屉手柄上方。 This approach is pretty crude and I'm hoping to avoid this because I would like the sliding drawer handle height to be dependent on its content (which is dynamic).这种方法非常粗糙,我希望避免这种情况,因为我希望滑动抽屉把手的高度取决于它的内容(这是动态的)。

Any suggestions to help achieve a more fluid layout?有什么建议可以帮助实现更流畅的布局吗?

You can control the height of the sliding drawer if you want to and I think that is the case with this question.如果您愿意,您可以控制滑动抽屉的高度,我认为这个问题就是这种情况。 The sliding drawer is just taking some space of the screen and other content should be above it滑动抽屉只占用屏幕的一些空间,其他内容应该在它上面

Can't you use a LinearLayout (Vertical), and set its position to bottom-align你不能使用线性布局(垂直),并将其 position 设置为底部对齐

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM