Using Custom Font
a. Download the font file (ex: abc.ttf, abc.xml, abc.ttf any type font file).
b. Res è Make a directory name [ “font” ]
c. Copy and paste the font file
d. Now : - for set font
i. Declare and initial the textview in java file
ii. .java file à oncreate() à
Code :
AssetManager am = context.getApplicationContext().getAssets();
typeface = Typeface.createFromAsset(am,
String.format(Locale.US, "fonts/%s", "abc.ttf"));
setTypeface(typeface);
or try this way:
TextView tx = (TextView)findViewById(R.id.textview1);
Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/abc.ttf");
tx.setTypeface(custom_font);
h
মন্তব্যসমূহ
একটি মন্তব্য পোস্ট করুন