在我的应用程序中,我想为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);
}
最后
以上就是坚定草莓最近收集整理的关于android 背景颜色 xml,Android在styles.xml中将背景颜色设置为TextView的全部内容,更多相关android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复