在我的应用程序中,我想为TextView设置一个样式,它将使TextView看起来像一个标题,如下图所示 –
当我从styles.xml(下面给出)应用样式时,它应用指定的字体和字体颜色.但是,它不适用于白色背景.我们可以做到这一点吗?
定义的风格是这样的 –
10dip
@color/white
10dip
match_parent
wrap_content
22sp
@color/black
bold
应用样式的代码就像
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textview = (TextView) findViewById(R.id.textView);
textview.setTextAppearance(ScrSettings.this,R.style.settings_header);
}