retrieve custom char with charcode android -
i'm using custom font characters star, sun, etc.
i know charcode font.
i set textview font following code:
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/myfont.ttf"); settypeface(tf ,1); }}
is there way, since know charcode, use specific characters directly in strings.xml , programmatically?
you can reference characters 4 digit hexadecimal code in java :
string somestring = "\u2776"
or in resources :
<string name="some_string_name">\u2776</string>
(2776 code ❶ in default font)
Comments
Post a Comment