2014-01-21 39 views

回答

2

您可以在這裏找到默認高度

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> 

檢查各自的資源下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大小」。

+0

出於好奇! Android說使用'sp'作爲文本大小的單位,但爲什麼這個傢伙在'dp'中使用文本大小(18dp)... –

+0

@GopalRao我從鏈接中選擇了它。你也可以從你的sdk中檢查源代碼。我不知道爲什麼 – Raghunandan

+0

謝謝guyz! –

0

它可以根據設備而變化。 here是所有設備的大小列表

+0

感謝您的幫助! –