android - 标题栏的默认高度和标题栏中的默认文本大小是多少?

标签 android android-titlebar

有谁知道 android 中 TitleBarTitleBarText 的默认大小是多少?

最佳答案

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

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

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

Quoting "you should prefer the sp (scale-independent pixel) to define text sizes. The sp scale factor depends on a user setting and the system scales the size the same as it does for dp".

关于android - 标题栏的默认高度和标题栏中的默认文本大小是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21251777/

相关文章:

android - 如何以编程方式获取应用程序的 .apk 文件

Android:更改标题栏中的对齐方式

android - 如何在 android 上的 Activity 标题中显示 'wait' 图标?

c# - UI层如何访问GetSystemService(AudioService)

android - Android 中的 MAT SDK 集成

安卓时钟应用设置闹钟

android - ViewPageIndicator- Jake Wharton- 为什么带有 viewpager 的选项卡显示的标题与 ICS 不同?

android - 有没有办法在 Android 中让 WebView 自动链接 URL 和电话号码?

android - 如何将按钮放在 Activity 标题中?

显示应用程序名称的 Android Studio 导航栏丢失了吗?