您的位置:首页 > 移动开发 > Android开发

android 中如何设置控件的字体和背景样式

2016-02-26 21:43 423 查看
1.设置背景图片,图片来源于drawable;

button.setBackgroundDrawable(getResources().getDrawable(R.drawable.search_label_click));

2.转换字符串为int(颜色);

button.setBackgroundColor(Color.parseColor("#F5F5DC"));

3.引用资源

button.setBackgroundResource(R.drawable.shapegray);

4.设置图片背景色

button.setBackgroundColor(Color.parseColor("#C8C8C8"));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: