I have a Text like this--> String aa= "এন্ড্রয়েডের শুরু থেকেই এরসাথে রয়েছে গুগল টক। এতে সর্বশেষ সংযোজন হিসেবে ভিডিও চ্যাটের ব্যবস্থা যোগ করা হয়েছে।";. The String is in bangla. We can not display it directly without installing bangla font. But i want to display it without installing font. Is it possible to display the string as a bitmap image and then put into the TextView? If possible then how? Please Help.
3 Answers
It is possible to set a background Drawable to a TextView, but this doesn't solve everything:
You could use the XML attribute android:background="...your_image_resource..." of your TextView in the AndroidManifest.xml. Or you could do it programmatically : public void setBackgroundDrawable (Drawable d).
But:
If this is an image, why to display it as the background of a
TextView(that will contain no text)? It would be better to display it as anImageViewin that case.It is not possible to dynamically create the
Bitmapof this text with the application as it would require to have the font installed to render the text in aBitmap. And if the font is installed, there is no need to use aBitmapto display it.
So, depending of your context:
Either this text is fixed (like a logo or a catch phrase for example), in which case the best is to build your image from outside the application, to include it as a
drawableresource and to display it as anImageViewOr it is not, in which case the user definitely needs to have the font installed on his/her device.
- 10,917
- 4
- 51
- 70
Why not include a Bangla font in your apk and let the OS do the work for you? http://www.barebonescoder.com/2010/05/android-development-using-custom-fonts/
- 10,618
- 2
- 32
- 36
-
i have tried this but in case of some complex character (ex. "ক্ষ","ত্ত") which is made of multiple fundamental characters(i.e. ক্ষ=combination of "ক", "্","ষ") it is not able to display the complex character instead display only the fundamental characters. – Md.Fazla Rabbi opu Jul 30 '11 at 03:32
-
1Ah, then Shlublu is correct, it seems you only have those two options. – Josh Aug 01 '11 at 16:12
