0

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 Answers3

4

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 an ImageView in that case.

  • It is not possible to dynamically create the Bitmap of this text with the application as it would require to have the font installed to render the text in a Bitmap. And if the font is installed, there is no need to use a Bitmap to 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 drawable resource and to display it as an ImageView

  • Or it is not, in which case the user definitely needs to have the font installed on his/her device.

Shlublu
  • 10,917
  • 4
  • 51
  • 70
0

Look at my answer How to draw text On image?

enter image description here

Community
  • 1
  • 1
Ashish Dwivedi
  • 8,048
  • 5
  • 58
  • 78
0

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/

Josh
  • 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
  • 1
    Ah, then Shlublu is correct, it seems you only have those two options. – Josh Aug 01 '11 at 16:12