63 questions
-1 votes
1 answer
52 views
How can I change pixelDensity midway through running the sketch? [closed]
I'm trying to change the sketch's pixel density after its been first initialized in setup. Basically, user can interact with some UI inputs and it should change pixelDensity based on that. However I ...
2 votes
2 answers
2k views
Why displayMetrics.density is wrong?
On my Pixel 7 device, I want to know how many density-independent pixels (dp) I have. So, I use this formula: displayMetrics.widthPixels / displayMetrics.density However, I have an issue because ...
0 votes
0 answers
121 views
Reducing the pixels-per-inch (PPI) of an image results in same file size
Summary I'm attempting to use ImageMagick to produce copies of an image with a range different pixel densities to increase the user-experience of my front-end projects. Problem After running the ...
1 vote
1 answer
1k views
What is the recommended way to convert between pixels and points in SwiftUI?
I want to display a QR code in SwiftUI. The code is generated as a CGImage via CIImage. I don't want to scale it to the full size available because if the scaling factor isn't an integer there may be ...
-1 votes
1 answer
1k views
Conversion of Figma designs to React Native
I have a figma file , it's a mobile screen and all elements in figma are using pixels for their height and widths. However react native does not have pixels in the way typical web apps have and the ...
-1 votes
3 answers
62 views
how can i solve the issue of right overflowed by 382 pixels
Problem: I have an overflow error when i use this widget (code below), How i solve the issue? You can see the error in the image below. enter image description here Container( height: 150, ...
5 votes
2 answers
6k views
responsive images with srcset, sizes, media-queries - Prevent loading huge images for higher pixel density
I used picture element for responsive images in different sizes per viewport a long time. it worked fine, but now I am forced to switch over to responsive <img> with srcset and sizes and I try ...
0 votes
1 answer
95 views
Density group for tablet of size 10.5" and 11"
I know it's been asked before but I cant find a solution to my problem Both devices have the same size 2650 * 1600 px One with size 10.5" has 287 ppi The other size 11" has 276 ppi As I ...
1 vote
1 answer
357 views
CodenameOne - Using 1x 2x 3x images of XCode Assets.Casset catalog in CN1 project
My CodenameOne app needs customized icons for some buttons. Images have to be used. The iOS version of my app was duly provided of those images in 1x 2x 3x formats. It seems that the multi-image ...
0 votes
1 answer
405 views
Android menu icons scaling issue
I am using the onCreateOptionsMenu method to create a toolbar with icons in the MainActivity of my app. I am testing on different screen sizes and pixel densities with Android Studio's emulator. The ...
3 votes
1 answer
1k views
What is the smallest possible screen size that will use sw-600dp layout?
I created layout-sw600dp/layout.xml and it was looking great on device A. But on device B this layout has melt and looks bad. I want to know how my layout looks in worst possible case scenario (...
0 votes
1 answer
83 views
Not getting exact value from float calculations in a java code [duplicate]
Basically I am changing layout ratios. I have to change current layout ratio to another ratio. There is a code snippet I am using in my application. import java.util.*; public class Big{ public static ...
0 votes
1 answer
417 views
Android: PDF created using PrintedPdfDocument looks different on different devices
I am trying to render a view to a PrintedPdfDocument. The size of the page, as expected, is in units 1/72nd of an inch. So, for an A0 size page (width = 33.11 in), document.getPageWidth() returns 2384 ...
3 votes
0 answers
406 views
How to display 10cm on web browser no matter the scaling?
I have 27' 4k monitor and would like to present 10cm on the web page as it represented as real dimension in real world. I'm using Windows 10 with scaling set to 175%. Chrome console devicePixelRatio ...
1 vote
1 answer
139 views
In Srcset with W units, does browser consider full resolution of high pixel density display?
If I specify srcset only in W units, does the browser consider high pixel density displays full resolution or its scaled down resolution? For example for this code... <img srcset=“image-xl.jpg ...