在游戏中心项目中需要调textview的字体颜色,按下需要换一种颜色。
之前用
mCenterInstallStatus.setTextColor(mContext.getResources().getColor(
R.color.applistitem_button_text));
这样子是不对的,无法响应按下变色的需求。
需要改成如下:
mCenterInstallStatus.setTextColor(mContext.getResources().getColorStateList(
R.color.applistitem_button_text));
重点是要用getColorStateList
最后
以上就是活力大象最近收集整理的关于android 代码中设字体颜色selector的全部内容,更多相关android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复