Hi. How do I set the size of text so that it appears the same size across all phones? In other words I want my text to be the same size on any phone regardless of its pixel density.
--
At the moment, to have 'scalable' fonts on various sizes of device screens you have to do something like shown in this example discussing screen size but will need toadapt it to the font also;
--
--
--
At the moment, to have 'scalable' fonts on various sizes of device screens you have to do something like shown in this example discussing screen size but will need toadapt it to the font also;
Universal screen size by Sajal Universal Screen Size Using App Inventor
Include a routine to set the font size of Buttons, Labels etc. to whatever you feel is appropriate for each screen size. You can use the Advanced controls to change the fonts for all the Buttons, Labels and probably do this by proportioning the font to the screen dimensions. There is no automatic way to do this with App Inventor 2 at present. It would help to have available a third party emulator that can show you what the results would be on various devices.
--
Ok. Do you know how to scale font sizes? Increasing the size of a button or label does not also increase the font size.
--
Sure. :) For a label, the default font size is 14.0 Change that to a larger value to get a larger font by using set Label.FontSize to 20 perhaps and see what it renders to. You also can change the font size in the Designer Properties bin, but to work with different size screens, you will have to use Block code.
Correct, Increasing the size of a button or label only changes the dimensions of the control's footprint.
It is easy for a developer to experiment with these properties in the Designer.
--
In my opinion, there is currently no way to adjust font size according to screen size. Using the example above, we can resize buttons/labels proportionally. In theory proportional re sizing can also be done for fonts (either as button or text on canvas) but it hits a snag because font size is in pixels and different phones have different pixel densities. Default is 320x480 and if you imagine a tablet as being 1200x800, then it will scale the font but will hit a snag for HD phones which have 1080x1200 resolution i.e. display will be even bigger on HD phone than tablet.
I think this generally ties in with posts related to scaling for tablets.I'd personally love to see this resolved and there seems to be an encouraging blog post
--
App Inventor doesn't currently have support for what Android developers call "responsive design", i.e., making apps look good across different screen sizes and different pixel densities. We're moving toward that to a limited extent. We're hoping to update the App Inventor system to API Level 4, and implement "density independent pixels". Look for that in the first quarter of 2015.
Once that's done, we'll have look at switching to "scalable fonts"l which will address some of the issues ecivon mentions. But only some of them.
Once that's done, we'll have look at switching to "scalable fonts"l which will address some of the issues ecivon mentions. But only some of them.
--
댓글 없음:
댓글 쓰기