android - Set textcolor and other attribute in textview extends -
how can set text color , text size in class below
public class mytextview extends textview { public mytextview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); init(); } public mytextview(context context, attributeset attrs) { super(context, attrs); init(); } public mytextview(context context) { super(context); init(); } public void init() { typeface tf = typeface.createfromasset(getcontext().getassets(), "font/chiller.ttf"); settypeface(tf ,1); } }
in init
use settextcolor
, settextsize
public void init() { typeface tf = typeface.createfromasset(getcontext().getassets(), "font/chiller.ttf"); settypeface(tf ,1); this.settextcolor(color.red); this.settextsize(20f); }
if looking custom attributes check this
Comments
Post a Comment