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
Post a Comment