I have some TextViews on my app, I don't know why but the android:gravity
attribute is not centering the text content where it should be on devices running the API 18+ (4.3+).
There is the code I use on my custom TextView
, this is a child of RelativeLayout:
<com.package.custom.CustomTextFont
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/seekbar"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/seekbar"
android:layout_marginLeft="@dimen/margin_tiny_double"
android:layout_toLeftOf="@+id/seekbar"
android:gravity="center_vertical|left"
android:paddingRight="@dimen/margin_tiny"
android:text="@string/text1"
android:textColor="@color/black"
android:textSize="@dimen/size_text_normal" />
This code should take the edges of this TextView
and align it to the top and bottom and put it to the Left of the SeekBar
, this is working, but the TextView
gets big, so with android:gravity
I center the text to the center and left from it self. It works, but I don't know why, the text is not centered at center|left on devices running android 4.3 and 4.4. This issue can be reproduced on real devices and as well on the layout preview (Graphic layout) of Eclipse.
There is any changes made on API 18+ or on android:gravity
that I'm missing?
PS: I'm targetting the API 19 on the project and on AndroidManifest.xml
PS2: My TextView is custom just to set an external font.tff
This is how it looks like on API 17-
This is how it looks like on API 18+
Thanks in advance!
= UPTADATE =
On my Manifest, I changed the android:targetSdkVersion
to 17 instead of 19 and the problem disappeared, but this is a "trick", not a solution, what can I do since it could be an issue from the API ? And yes, I have the latest version of the API 18 and 19 (today, 01/30/2014).