December 19, 2013

Font-icon technique in Android. Critical issue!

This post oriented for those who already read and used font-icon drawables from previous post.

During testing our application we found big issue - on some devices font-icons were invisible in ActionBar. This issue threatens this solution to be deleted from our project.

Problem device was Huawei Honor 2 U9508 with stock firmware Android 4.0.4.

After some time of debugging solution was found!

When you implementing custom Drawable you must override methods getIntrinsicWidth() and getIntrinsicHeight(). Some platforms does not make any assumptions about size of your Drawable and provide Canvas with size of 1x1 to the method draw().

Diff is very simple, find whole solution on github.