android 可以在程序代码中设置样式:style

<style name="text_style">
<item name="android:textStyle">bold</item>
<item name="android:textSize">18sp</item>
</style>
xml使用:
<TextView
style="@style/button_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
</TextView>
java代码使用:
TextView txtname = new TextView(this);
txtname.setTextAppearance(this, R.style.text_style);

猜你喜欢

转载自www.cnblogs.com/zmc/p/9187493.html
今日推荐