Programmatically set text color to primary android textview -
how can set text color of textview
?android:textcolorprimary
programmatically?
i've tried code below sets text color white both textcolorprimary , textcolorprimaryinverse (both of them not white, have checked through xml).
typedvalue typedvalue = new typedvalue(); resources.theme theme = getactivity().gettheme(); theme.resolveattribute(android.r.attr.textcolorprimaryinverse, typedvalue, true); int primarycolor = typedvalue.data; mtextview.settextcolor(primarycolor);
finally used following code primary text color of theme -
// primary text color of theme typedvalue typedvalue = new typedvalue(); resources.theme theme = getactivity().gettheme(); theme.resolveattribute(android.r.attr.textcolorprimary, typedvalue, true); typedarray arr = getactivity().obtainstyledattributes(typedvalue.data, new int[]{ android.r.attr.textcolorprimary}); int primarycolor = arr.getcolor(0, -1);
Comments
Post a Comment