roboto - Android TextView custom typeset causes gravity to stop working -


update

this appears happening roboto-italic.ttf. if you're running issue, try font family.


i'm running odd issue when applying typeset textview. app name, "contact" in linearlayout android:gravity="center" set, causes centered nicely seen in "before" image below. when set typeface, causes gravity stop working reason. how i'm setting typeface:

tvappname.settypeface(   typeface.createfromasset(getactivity().getassets(),"fonts/roboto-italic.ttf")); 

any idea why might happening? i've tried setting gravity programmatically, didn't help. commenting 1 line causes text go being centered.

before

imgur

after

imgur

the roboto-italic.ttf file google's website seems broken or incompatible in way. work-around use normal roboto font specify italic 2nd argument:

typeface tf = typeface.createfromasset(getactivity().getassets(), "fonts/roboto-normal.ttf"));  tvappname.settypeface(tf, typeface.italic); 

what fake italics putting skew on text. theoretically not nice, solves problem of gravity , other layout attributes not working real roboto italic.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -