【发布时间】:2013-07-02 07:42:35
【问题描述】:
我知道有很多关于 setTextAppearance 的讨论,但我搜索并没有找到任何适合我的东西...
我正在以编程方式设置 textView 的代码,它位于 tablerow 内。
但是,当我尝试从 textView 上的 styles.xml 调用样式时,它不适用。
来自styles.xml:
<style name="ElemTabArtikl">
<item name="android:layout_marginLeft">10dp</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
</style>
java中的代码:
TextView tvNazArt = new TextView(this);
tvNazArt.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT, 0.4f));
tvNazArt.setTextAppearance(this, R.style.ElemTabArtikl);
tvNazArt.setText(NazivArt);
tvNazArt.setPadding(10, 0, 0, 0);
artikliVrstica.addView(tvNazArt);
【问题讨论】: