0

Emulator/Device Specs:

HDPI

RESOLUTION 1280 x 800

SCREEN SIZE 5.3

Following two images are captured from two emulators with specs mentioned above. Both emulators have everything same except OS version

enter image description here ANDROID 2.3.5 (Gingerbread)

enter image description here ANDROID 4.1.1 (Jelly Bean)

I have used a custom background image for EditText. For EditText android:textAppearance property is set to 70sp for both emulators.

So, my question is why on Jelly Beans text size is bigger than text size on gingerbread?

Note: This issue is also seen on ICS.

UPDATE:

enter image description here

This is what i am getting now after making the EditText background image nine-patch. The text is not fit inside the EditText

Following are the EditText properties in XML.

 <EditText
        android:id="@+id/phone_number"
        android:layout_width="fill_parent"
        android:layout_height="150dip"
        android:layout_gravity="center"
        android:layout_marginLeft="28dip"
        android:layout_marginRight="28dip"
        android:background="@drawable/lcdscreen_no_glow"
        android:singleLine="true" 
        android:maxLength="12"
        android:inputType="phone"
        android:textAppearance="@style/EditTextStyleMedium"      
        android:gravity="center"
        android:textStyle="bold"
        android:clickable="false"
        android:longClickable="false"
        android:cursorVisible="false"/>
MA1
  • 2,767
  • 5
  • 35
  • 51

1 Answers1

1

I have used a custom background image for EditText

That background image should be a nine-patch PNG file so that it can stretch accordingly.

So, my question is why on Jelly Beans text size is bigger than text size on gingerbread?

If nothing else, the default font is different. Android 1.x/2.x used the Droid font family, while Android 4.x uses Ruboto. Since, by eyeball, the heights appear the same, the Ruboto glyphs for 9 are apparently wider.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks. So what you suggest? Change the font size at runtime? – MA1 Dec 23 '12 at 13:04
  • @MA1: I suggest having a stretchable background. – CommonsWare Dec 23 '12 at 13:16
  • @MA1: Since your width is `fill_parent`, make the parent bigger. Or, make your font size be a dimension resource and have versions of that resource in `res/values/` and `res/values-v14/` (the latter would be used for Android 4.0+). – CommonsWare Dec 23 '12 at 13:56