How to fix the original font in Android Lollipop when working with custom icon fonts?

I am currently using FontAwesome in one of my Android projects. I mainly use it to display icons to the left of text on specific buttons. I noticed that since the upgrade of one of my test devices to Lollipop, the icons began to sag below the baseline of the text on the button. Check out the images below:

Android KitKat (Nexus 7) - good:

Kitkat

Android Lollipop (Nexus 4) - bad:

Lollipop

Note that the bottom of the icon in the first image is on the baseline of the text, and the bottom of the icon in the second image is below the baseline.

the code:

<string name="button_text_logout"> LOG OUT</string> <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:textSize="@dimen/text_size_menu_item" android:textColor="@color/white" android:gravity="center_vertical" android:text="@string/button_text_logout" android:paddingLeft="@dimen/action_item_padding" android:paddingRight="@dimen/action_item_padding"/> Typeface typeface = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf"); logOutTextView.setTypeface(typeface); 

I am using the fa-sign-out icon. The code works fine on all devices running Android versions up to 5.0. Is there any way to fix this?

+5
source share
1 answer

late, but may help someone, after fixing this problem with android:includeFontPadding="false"

+1
source

Source: https://habr.com/ru/post/1208193/


All Articles