首页 > 系统 > Android > 正文

android 动态设置actionbar背景色(代码修改)

2019-11-09 14:13:46
字体:
来源:转载
供稿:网友

一、将十六进制颜色值转为int类型color

int color = Color.parseColor(“#ff00ff”);  

二、将int类型color值转为Drawable类型

ColorDrawable drawable = new ColorDrawable(color);  

三、将drawable设置给actionbar

actionBar.setBackgroundDrawable(drawable);
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表