---
title: "android textview 代码设置颜色状态"
author: "hkk"
date: "2012-05-14T14:33:03Z"
tags: []
categories: ["移动开发"]
slug: "android-textview"
draft: false
lastmod: "2012-05-14T14:32:36Z"
id: 1528276
url: "https://hkk.iteye.com/blog/1528276"
---

try {  
   Resources resource = (Resources) getResources();  
   ColorStateList csl = (ColorStateList) resource  
     .getColorStateList(R.color.qianqubtnselector);  
   btn.setTextColor(csl);  
  } catch (Exception e) {  
  }

代码设置颜色