2013-10-17 58 views

回答

0

这将颜色从XML改变:

<TextView 
android:layout_width="wrap_content" 
android:layout_height"wrap_content" 
android:textColor="#123123" 
/> 

更改字体是多一点点深入。将所需的字体文件放入项目的assets文件夹中,并使用TextView的setTypeface()方法。这在前面的问题中已经得到了说明:How to change the font on the TextView?

+0

谢谢。所有样式都添加到它自己的部分吗?喜欢是不是有什么像CSS,你做了一个ID标识的风格,并适用于所有小部件,持有该ID?! –

+0

你可以做类似的事情,请看这里:http://developer.android.com/guide/topics/ui/themes.html – FoamyGuy

0

好的,这里是TextView的文档。基本上有两种使用xml和java代码设置文本视图的方式。这里是相关的xml属性:

android:textColor 
android:textColorHighlight 
android:textColorHint 
android:textSize 

依此类推。在代码上,它看起来像这样:

TextView tv = (TextView) findViewById(R.id.tv); 
tv.setTextColor(Color.BLACK); 
相关问题