安卓中TitleBar的默认高度和标题字体大小是多少?

4

有人知道在Android中TitleBarTitleBarText的默认大小是多少吗?


我认为这可能会因设备而异。 - Linga
使用HierarchyViewer并自行查找。 - pskink
2个回答

3

您可以在此处找到默认高度

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/frameworks/base/core/res/res/values/dimens.xml

以下是针对4.0.3的内容

<dimen name="action_bar_default_height">48dip</dimen>
<dimen name="action_bar_title_text_size">18dp</dimen>

请检查各自res/values文件夹下的dimens.xml。
针对Gopal Rao的评论。 http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/frameworks/base/core/res/res/values/styles.xml?av=f中的注释。
<style name="TextAppearance">
        <item name="android:textColor">?textColorPrimary</item>
        <item name="android:textColorHighlight">?textColorHighlight</item>
        <item name="android:textColorHint">?textColorHint</item>
        <item name="android:textColorLink">?textColorLink</item>
        <item name="android:textSize">16sp</item> // its is in sp not dp 
        <item name="android:textStyle">normal</item>
    </style>

http://developer.android.com/guide/practices/screens_support.html

如果您查看最佳实践主题。

引用“您应该优先选择sp(可缩放独立像素)来定义文本大小。 sp比例因用户设置而异,系统会按照dp一样缩放大小”。


出于好奇,安卓说要使用“sp”作为文本大小的单位,但是为什么这个家伙在使用“dp”(18dp)作为文本大小呢? - Gopal Gopi
@GopalRao 我从链接中获取了它。你也可以从你的SDK中检查源代码。我不确定为什么。 - Raghunandan
如果你查看 http://developer.android.com/guide/practices/screens_support.html ,它会告诉你使用 sp,我认为这仅适用于标题文本而不是 dp - Raghunandan

0

这取决于设备。此处是所有带尺寸的设备列表


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接