I've worked with the Toolbar before and all the comments from CommonsWare are absolutely correct.
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.
Put it inside a FrameLayout
, put a layout_margin
parameter on it, make the layout_width
NOT match_parent
and that's it.
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…