浮动工具栏与Appcompat [英] Floating Toolbar with Appcompat
问题描述
如何创建与下图类似的浮动工具条中的建议,材料设计方针,并在谷歌地图应用程序。
How to create a floating toolbar like the following image as proposed in the material design guidelines and in the Google Map application.
推荐答案
我以前使用工具栏的工作,并从CommonsWare所有的意见是完全正确的。
I've worked with the Toolbar before and all the comments from CommonsWare are absolutely correct.
在工具栏
部件(<一href="https://developer.android.com/reference/android/support/v7/widget/Toolbar.html">https://developer.android.com/reference/android/support/v7/widget/Toolbar.html)绝对没有什么特别的或比任何其他不同的的ViewGroup
并没有不同的表现比任何其他的ViewGroup。
The Toolbar
widget (https://developer.android.com/reference/android/support/v7/widget/Toolbar.html) have absolutely nothing special or different than any other Viewgroup
and does not behave differently than any other ViewGroup.
把它放在一个的FrameLayout
,把 layout_margin
参数里面就可以了,让 layout_width
不是 match_parent
,仅此而已。
Put it inside a FrameLayout
, put a layout_margin
parameter on it, make the layout_width
NOT match_parent
and that's it.
将其放在一个的LinearLayout
与方向=水平
键,您可以使用 layout_weight
来控制比例的大小。或者只是使用普通的浸
如果适合您的需求。
Put it inside an LinearLayout
with orientation=horizontal
and you can use the layout_weight
to control the size in percentage. Or just use plain dip
if that suits your needs.
这篇关于浮动工具栏与Appcompat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!