2014-12-26 58 views

回答

0

在Java類中,你可以做如下

Button bt = new Button(this); 
bt.setTextSize(12); 

和XML

<Button 
    android:textSize="10sp"/> 

注:文本推薦尺寸類型爲 「SP」,以便擴大像素。

+0

我並不是想要調整文本大小,但是我想在整個按鈕上顯示文本和按鈕邊框之間沒有任何空間的文本。 –

0
Button button = new Button(this); 

// set the text size in the second parameter. I have set 20 for the sake of your understanding. 
button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); 

讓我知道它是否有效。

+0

@Szymon Starzak有用嗎? –