Home  >  Forum  >  Android
Post New Query

Android - How to set and get TextView Background Color Programmatically


joined on
June 15,2014
Asked on September 15,2015

How to set and get TextView background color programmatically in Android?

joined on
March 14,2013
Replied on September 15,2015

Suppose we have a TextView as

TextView text = (TextView) activity.findViewById(R.id.text);


1. Set Background Color Programmatically


text.setBackgroundColor(Color.LTGRAY);


2. Get Background Color Programmatically


(ColorDrawable)text.getBackground()).getColor();


joined on
June 15,2014
Replied on September 15,2015

Thanks for quick response. It's working.

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us