9/27/2023 0 Comments Switchresx sidecar> Android doesn't have to deal with this. When you use XML and specify `25dp`, the system does the rounding. Even though there's no such thing as pixel-perfect on AMOLED displays thanks to their subpixel layout. View dimensions are integers, so you have to, but graphics APIs take floats, you don't strictly have to, but you want to anyway. Yeah, on Android, you're supposed to round yourself. > The short answer to your question is "rounding." The thing I love about HackerNews is how you can casually run into people who worked on things you've been using every day for the last 10 years. Android has always supported UI scaling, so there was no problem designing the API the way it is. I guess Apple thought it would make it easier to adapt existing apps to retina displays. On macOS and iOS, all graphics APIs take "points", which are those logical pixels you get after the scaling is applied, "density-independent pixels" as Android calls them. It's your job to multiply and round everything correctly. On Android, all draw calls on the Canvas, and all view dimensions and other things like text sizes, always take physical pixels. Įdit: one important difference I forgot to mention. Even more curious is the fact that they have returned it as a float for as long as retina displays were a thing. Some iPhone models, too, render the UI at 3x and then downscale it to fit the screen. With how advanced macOS graphics stack is, I don't understand why does Apple not do this, instead insisting on using integer multipliers. Oh and there's also "ldpi", which is something like 0.75x, though there were very few devices with it. You can provide separate resources for each pixel density if you still use bitmap graphics for some reason. Some devices have non-integer pixel densities (multipliers or device pixel ratios or scaling factors or whatever term you prefer), especially 1.5x aka "hdpi" that was popular around 2011.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |