[英]How to set Bangla font to a TextView in Android
嗨,我是孟加拉國人。
我是Android編程的新手。
我有一個EditText。 我需要設置孟加拉語。
我能做什么。
<EditText android:id="@id+/title"
android:width="fill_parent"
android:height="200dp"
android:text="ঘূর্ণিঝড় রোয়ানুর কারণে"
/>
下載您的字體並將其保存在資產文件夾中。 將您設置為TextView的文本寫入values文件夾中的strings.xml中
<string name="text_of_title">ঘূর্ণিঝড় রোয়ানুর কারণে</string>
現在像這樣將其添加到TextView
<EditText android:id="@id+/title"
android:width="fill_parent"
android:height="200dp"
android:text="@strings/text_of_title"/>
現在編寫Java代碼以將字體添加到TextView
TextView title = (TextView) findViewById(R.id.title);
String BANGLA_FONT_SOLEMAN_LIPI = "/SOLAIMANLIPI_22-02-2012.TTF";
Typeface tf = Typeface.createFromAsset(con.getAssets(),
BANGLA_FONT_SOLEMAN_LIPI);
title.setTypeface(tf);
就這樣。 我希望你會喜歡它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.