How can I use bangla font as string value in android

how can I use the bangla font in an Android application as a string value in a string.xml file and also read in my UI.Advance thanks to the answer

+5
source share
2 answers

First open the folder assetsand create a new folder with the name font, and then put it Rupali.ttfin the folder font.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:id="@+id/DefaultFontText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="30sp"
        android:text="Here is some text." />
    <TextView
        android:id="@+id/CustomFontText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="30sp"
        android:text="ডিরেক্টর মমনক(!?) করতেছি অন্তত ঘড়িটা যেন বানাতে পারি আমি চেষ্টা করছি">
        </TextView>
</LinearLayout>

and

package com.amader;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;

public class Fonts extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Typeface tf = Typeface.createFromAsset(getAssets(),
                "font/Rupali.ttf");
        TextView tv = (TextView) findViewById(R.id.CustomFontText);
        tv.setTypeface(tf);
    }
}

Disadvantage: all bangla combo words do not work correctly. If anyone has a solution, please let me know.

+9
source

Please follow the method below:

create a folder named assets under the application folder

fonts

bangla, durga.ttf otf

, :

yourTextView.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Durga.ttf"));
+1

All Articles