0

这个问题对我这个初学者来说可能很简单但很难。我正在通过java开发一个Android应用程序。所以有一个TextView。

我怎样才能给它添加一些风格。比如改变它的颜色、字体等等??

4

2 回答 2

0

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

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

等等。在代码上它看起来像这样:

TextView tv = (TextView) findViewById(R.id.tv);
tv.setTextColor(Color.BLACK);
于 2013-10-17T00:43:28.220 回答
0

这将从 xml 更改颜色:

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

更改字体更深入一点。把你想要的字体文件放到你项目的assets文件夹中,使用setTypeface()TextView的方法。这已在上一个问题中讨论过:如何更改 TextView 上的字体?

于 2013-10-17T00:37:24.700 回答