Android工具栏的高度是多少? [英] What's the height of the Android Toolbar?
问题描述
Lollipop中引入的Android Toolbar
的高度是多少?这是一个非常简单的问题,但是除了ActionBar
之外,我在这里没有找到答案.但高度不同.
What is the height of the Android Toolbar
introduced in Lollipop? It's a quite simple question but I haven't found an answer here except for the ActionBar
; but it has a different height.
推荐答案
Toolbar
(如果未扩展)的高度为:
The Toolbar
(if not extended) has the height of:
-
56dp
(默认) -
48dp
(横向) -
64dp
(sw600dp;即平板电脑)
56dp
(default)48dp
(landscape)64dp
(sw600dp; i.e. tablet)
Toolbar
高于棒棒糖之前的ActionBar
;默认情况下为48dp
,横向为40dp
,在sw600dp中为56dp
.
The Toolbar
is higher than the pre-lollipop ActionBar
; it was 48dp
by default, 40dp
in landscape and 56dp
in sw600dp.
并使用XML检索工具栏的高度,只需使用
And to retrieve the height of the Toolbar in XML, just use
?android:attr/actionBarSize
或者如果您正在使用AppCompat库
or if you're using the AppCompat library this
?attr/actionBarSize
这篇关于Android工具栏的高度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!