2012-03-30 60 views
2

我intrested操纵TextView的并将其设置为setTextAppearance())动态。 (我想知道为什么Google总是为XML添加代码片段代码,而不是与Java代码一起)。Android - 大TextView dyanamically

是否有人熟悉如何做到这一点?

UPDATE

TextView txtVw = new TextView(this); 
tblRow.addView(txtVw); 
txtVw.setTextAppearance(this, android.R.attr.textAppearanceLarge); 

TextView的出现在屏幕上,尽管它不会出现大

回答

10

你有没有尝试过这样的:

textView.setTextAppearance(context, android.R.style.TextAppearance_Large); 
+0

感谢您的快速回复,我不知道在哪里了''textAppearanceLarge ''居住,所以谢谢你的参考。为了得到这个工作,我将用''this'替换''context''。对? – MrRoth 2012-03-30 20:26:55

+0

它没有将textview设置为一个大的,即textview出现在屏幕上,虽然它不是**大** :( – MrRoth 2012-03-30 20:31:51

+0

这就是我认为...允许我编辑答案。 – Cristian 2012-03-30 20:38:13

1

这样更好,把它放到你的TextView XML声明

android:textAppearance="?android:attr/textAppearanceLarge"