android - Add Color "#e3bb87" to StateListDrawable programmatically -


the reason need programmatically text color downloaded , not pre defined in xml. read replace selector images programmatically

i need know from

statelistdrawable states = new statelistdrawable(); states.addstate(new int[] {android.r.attr.state_pressed},     getresources().getdrawable(r.drawable.pressed)); 

how turn into

states.addstate(new int[] {android.r.attr.state_pressed},**themethodimlookingfor**("#e3bb87")); 

forget getresources().getcolor(r.color.anycolor) , color not defined in xml

you can use this:

states.addstate(new int[] {android.r.attr.state_pressed},     new colordrawable(color.parsecolor("#e3bb87"))); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -