Wednesday, June 26, 2013

Setting background color through java code? - Android


It is quite easy to set the background color programatically of an Android Textview,

Option1:

TextView et = (TextView)findViewById(R.id.someTextView); someTextView.setText("Some text With Color"); someTextView.setBackgroundColor(Color.white);

Option2:

someTextView.setBackgroundColor(Color.parseColor("#ffffff"));

Option3:

someTextView.setBackgroundResource(R.color.white);


No comments:

Post a Comment