2014-07-02 17 views

回答

2

Android使用可擴展點或SP

這裏是一個樣本

<TextView 
     android:id="@+id/textView4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Sample Text - 26sp" 
     android:textSize="26sp" /> 

Reference

+0

它可以應用於android:layout_height和android:layout_marginTop等選項嗎? – user3121403

+2

應該補充一點,SP根據用戶選擇的字體大小進行縮放。有密度像素(DP)。 DP =默認字體大小的SP,但它們不根據字體大小進行縮放。 SP應該用於文本,DP更適合邊距,元素大小等。 – Marius

2

您正常使用DP適用於查看尺寸。
sp字體大小。