Is replacing ImageView/ImageButton (set for icons) with Textview using custom icon fonts Good practice?

221 views Asked by At

What are the advantages/problems when using ImageView/ImageButton with TextView using custom made icon fonts in-app layouts.

There are many online services where we can upload images and create custom fonts, so instead of keeping different density drawable, we only need a custom font, Is there any problem with this solution or any tweaks needed?

To apply custom fonts we can use createFromAsset method

Typeface font = Typeface.createFromAsset(getAssets(), "icons.ttf");

or use library like Calligraphy

NOTE: my question is about explanations/issues related to replacing ImageView/ImageButton icons with icon fonts using TextView Typeface.

3

There are 3 answers

1
rds On BEST ANSWER

The framework certainly favors the use of drawable rather than a custom font.

  1. vector drawable have more features, for instance, they allow animations.
  2. custom fonts may have render problems on devices.
  3. using Textview contentDescription feature will be not available, and hence will cause accessibility problems.
  4. latency of loading the custom font is also a factor.
  5. In the case where background option required, using custom font is not an option.
  6. You have also much less control regarding the sizing and spacing when using fonts.
0
Sagar Patil On

You can create custom icons with different text fonts by using this link.

Regarding your question, It will be useful to use ImageView/ImageButton as processing time for it will be less as compared to processing custom fonts. Also including external libraries may increase your app size.

0
parik dhakan On

Yes, sometimes while we use it with more that 2 to 3 image at a time so at that time it will help us to set as we want with size and all that we can do. So we can use it also.