[英]Overlay part of an imageview over toolbar
I am trying to overlay part of an image view over a toolbar as shown in the below image. 我试图将图像视图的一部分覆盖在工具栏上,如下图所示。
I have tried using a custom floating action button (using a rectangular canvas) described by Sanjeet Ajnabee here . 我尝试使用Sanjeet Ajnabee 此处描述的自定义浮动操作按钮(使用矩形画布)。 But, I want only a part of the image to be on the toolbar unlike a floating action button.
但是,与浮动操作按钮不同,我只希望图像的一部分位于工具栏上。
Using a dialog wouldn't work as well. 使用对话框也无法正常工作。 I want the image to be part of the layout.
我希望图像成为布局的一部分。
Any idea to start with will help. 任何开始的想法都会有所帮助。
That's pretty simple, you just use a NoActionBar
style and then a Layout like the pseudo-XML below: 这很简单,您只需使用
NoActionBar
样式,然后使用如下的伪XML布局:
<FrameLayout>
<Toolbar height="60dp" paddingBottom="12dp"> // here is the Toolbar
<ImageView marginTop="48dp" /> // marging top = 60-12=48
<FrameLayout marginTop="60dp">
// add here the rest of your layout
</FrameLayout>
</FrameLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.