2012-12-06 71 views
4

我有一個TextView。我想設置它的背景顏色。但是顏色填充的頂部空間比底部空間要多。TextView上意外的頂部和底部填充?

<!-- red background. --> 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textSize="14sp" 
    android:textStyle="bold" 
    android:background="#f00" 
    android:text="10.0" /> 

這是它呈現怎樣(放大展示,綠線由我添加的):

enter image description here

所以額外的空間向上頂使它看起來像文字不居中內它自己的容器。這是預期的嗎?我希望文本在其自己的容器(紅色區域)內垂直居中顯示。

這是一個星系連結,股票版本的軟糖。

感謝

+0

如果appwidget,看看http://stackoverflow.com/questions/10629249/unexpected-button-padding-on-ics/ 20135309#20135309 –

回答

11

添加以下屬性:

android:includeFontPadding="false" 
+2

真棒,一直在尋找! – user291701

+1

這是我第N次來到這裏,每次都很棒 – lelloman

相關問題