如何在android中使用bangla字体作为字符串值

Nah*_*hid 6 java fonts android android-widget

我怎么能在Android应用程序中使用bangla字体作为我的string.xml文件中的字符串值,并在我的UI中读取.感谢回答

Nah*_*hid 10

首先打开assets文件夹并创建一个名为的新文件夹font然后放入Rupali.ttffont文件夹.

<?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>
Run Code Online (Sandbox Code Playgroud)

和,

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);
    }
}
Run Code Online (Sandbox Code Playgroud)

缺点:所有孟加拉组合词都不能正常工作.如果有人有解决方案,请告诉我.