简体   繁体   中英

what “font size” measurement should i use in titanium?

Given that it is for both android and ios devices, and given that i'd like the screens to be pretty consistent across different screen sizes/resolutions?

I'm using font-size right now, but there is a massive disparity between what the android emulator shows and what an actual android device displays.

Try this, you can you without any measurement (dpi or px). this is working. bye the way you also you with (dpi or px) on your requirement.

var name    =   Ti.UI.createLabel({
    backgroundColor : "#e3e3e3",
    text        : data_ary[z].name,
    height      : "40",
    left        : "70",
    width       : "auto",
    color       : "#2c2c2c",
    font        : {fontSize : 18,fontWeight: "bold"},
});

so my question (now fixed) was a bit... wrong? I noted that i was using fontSize without really specifying what that meant.

I really should have noted that i was using fontSize without any units of size. Following on from Richard's suggestion, i'm using the units "sp", so for example:

font: {fontSize: '14sp'}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM