Showing posts with label Use hindi fonts android programming. Show all posts
Showing posts with label Use hindi fonts android programming. Show all posts

Wednesday, May 1, 2013

Use external fonts in android programming

Use hindi fonts android programming
Use external fonts android programming

Inside the assets folder of your project create a new folder and name it as fonts. Copy the font(.ttf) files in this folder. In our case the font files are RockFont.ttf and FEASFBRG.TTF.


setContentView(R.layout.main);
        Typeface font1 = Typeface.createFromAsset(getAssets(), "fonts/RockFont.ttf");
        Typeface font2 = Typeface.createFromAsset(getAssets(), "fonts/FEASFBRG.TTF");
        TextView customText1 = (TextView)findViewById(R.id.text1);
        TextView customText2 = (TextView)findViewById(R.id.text2);

        customText1.setTypeface(font1);
        customText1.setTextSize(40.f);
        customText1.setText("Hello! This is a custom font...");
        
        customText2.setTypeface(font2);
        customText2.setTextSize(30.f);
        customText2.setText("Developed by www.bOtskOOl.com");