色を指定する場合は、Colorクラスを使用します。
import android.app.Activity;
import android.graphics.Color;
public class MyClass extends Activity{
public void myMethod(){
TextView text = (TextView)this.findViewById(R.id.myText);
// Colorで定義された色
// BLACK, BLUE, CYAN, DKGRAY, GRAY, GREEN, LTGRAY, MAGENTA,
// RED, TRANSPARENT, WHITE, YELLOW
text.setTextColor(Color.WHITE);
// オリジナル色指定
// dimgray 0x696969
text.setTextColor(Color.rgb(105,105,105));
// オリジナル色指定(透明度含む)
// 透明度 0~255
// dimgray 0x696969
text.setTextColor(Color.argb(255,105,105,105));
}
}


コメント