Android工具栏的高度是多少? [英] What's the height of the Android Toolbar?

查看:450
本文介绍了Android工具栏的高度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆