Android font size difference issue on gingerbread and jellybeans

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 07:57:14

问题


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

ANDROID 2.3.5 (Gingerbread)

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:

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"/>

回答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.



来源:https://stackoverflow.com/questions/14010644/android-font-size-difference-issue-on-gingerbread-and-jellybeans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!