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

setting color of paint object in custom view


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -