2010-09-28 5 views
4

Я хочу, чтобы сделать TextView полужирным. Это, как я устанавливаю его внешний вид (мне нужно сделать это в коде):Как сделать TextView полужирным?

nameText.setTextAppearance(getApplicationContext(), R.style.BlueText); 
priceText.setTextAppearance(getApplicationContext(), R.style.BlueText); 
changeText.setTextAppearance(getApplicationContext(), R.style.BlueText); 

Вот мой style.xml

<!-- Blue Color --> 
    <style name="BlueText"> 
     <item name="android:textColor">#4871A8</item> 
    </style> 

Как я могу убедиться, что мой TextView выделен жирным?

ответ

11
<!-- Blue Color --> 
    <style name="BlueText"> 
     <item name="android:textColor">#4871A8</item> 
     <item name="android:textStyle">bold</item> 
    </style> 
0

На соответствующую записку, если вы хотите сделать то же самое без XML вообще, вы можете сделать это:

TextView MYTEXT = новый TextView (это);
myText.setTextColor (Color.BLUE);
myText.setTypeface (Typeface.DEFAULT_BOLD);

Смежные вопросы