Questions tagged [dpi]

DPI stands for Dots Per Inch

Dots per inch (DPI, or dpi) is a measure of spatial printing or video dot density, in particular the number of individual dots that can be placed in a line within the span of 1 inch (2.54 cm).

1133 questions
892
votes
34 answers

Converting pixels to dp

I have created my application with the height and width given in pixels for a Pantech device whose resolution is 480x800. I need to convert height and width for a G1 device. I thought converting it into dp will solve the problem and provide the same…
Indhu
  • 9,226
  • 3
  • 15
  • 17
531
votes
19 answers

getting the screen density programmatically in android?

How to get the screen density programmatically in android? I mean: How to find the screen dpi of the current device?
Praveen
  • 86,996
  • 72
  • 173
  • 215
373
votes
9 answers

Load dimension value from res/values/dimension.xml from source code

I'd like to load the value as it is. I have two dimension.xml files, one in /res/values/dimension.xml and the other one in /res/values-sw360dp/dimension.xml. From source code I'd like to do something like…
Héctor Júdez Sapena
  • 4,821
  • 3
  • 21
  • 30
153
votes
8 answers

How to write WinForms code that auto-scales to system font and dpi settings?

Intro: There's a lot of comments out there that say "WinForms doesn't auto-scale to DPI/font settings well; switch to WPF." However, I think that is based on .NET 1.1; it appears they actually did a pretty good job of implementing auto-scaling in…
Brian Kennedy
  • 3,242
  • 3
  • 18
  • 25
107
votes
5 answers

How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?

I've created a simple Winforms application in C#. When I run the application on a machine with high DPI settings (e.g. 150%), the application gets scaled up. So far so good! But instead of rendering the fonts with a higher font size, all texts are…
Boris
  • 7,424
  • 21
  • 59
  • 105
89
votes
4 answers

What's the correct size icon for drawable-xxhdpi?

As we know, the correct sized icon: * drawable-ldpi (120 dpi, Low density screen) - 36px x 36px * drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px * drawable-hdpi (240 dpi, High density screen) - 72px x 72px * drawable-xhdpi (320 dpi,…
Jerikc XIONG
  • 3,189
  • 5
  • 36
  • 62
78
votes
11 answers

How to get Windows Display settings?

There is setting for Display in Windows 7 (Control Panel -> Display). It allows to change the size of the text and other items on the screen. I need to get this setting to be able to switch on/switch off some functionality in my C# application based…
newmember
  • 783
  • 1
  • 5
  • 5
74
votes
6 answers

How to set the DPI of Java Swing apps on Windows/Linux?

If you have an monitor with a DPI over 150 (such as Macbook Pro), you may also find the problem: the font on the Java Swing app is too small for high DPI monitor, and I cannot change the font size at all ( It ignores the Windows DPI directly, only…
Searene
  • 19,507
  • 34
  • 112
  • 159
72
votes
9 answers

Creating a DPI-Aware Application

I have a form application in C#. When I change the monitor's DPI, all the controls move. I used the code this.AutoScaleMode = AutoScaleMode.Dpi, but it didn't avoid the problem. Does anyone have an idea?
RRR
  • 3,421
  • 13
  • 48
  • 68
71
votes
11 answers

How can I get the DPI in WPF?

How can I get the DPI in WPF?
tom greene
  • 5,181
  • 9
  • 34
  • 51
55
votes
4 answers

How to access screen display’s DPI settings via javascript?

Is there a way to access the screen display's DPI settings in a Javascript function? I am trying to position a HTML panel on the page and when the user's DPI is set to large (120), it throws the position off. I need to be able to know what the DPI…
Yttrium
  • 1,969
  • 7
  • 24
  • 28
55
votes
13 answers

Detecting the system DPI/PPI from JS/CSS?

I'm working on a kind of unique app which needs to generate images at specific resolutions according to the device they are displayed on. So the output is different on a regular Windows browser (96ppi), iPhone (163ppi), Android G1 (180ppi), and…
Josh Santangelo
44
votes
1 answer

Set the size of ggsave exactly

R question. I got so confused by the width, height, dpi and unit. Why the following two size different? ggsave(filename = "foo.png",ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point(size=2, shape=23),width = 5, height = 4, dpi = 300, units = "in",…
WCMC
  • 1,264
  • 3
  • 15
  • 30
41
votes
2 answers

Scaling the non-client area (title bar, menu bar) for per-monitor high-DPI support

Windows 8.1 introduced the ability to have different DPI settings for different monitors. This feature is known as "per-monitor high-DPI support." It persists and has been further refined in Windows 10. If an application does not opt in (i.e., is…
Cody Gray
  • 222,280
  • 47
  • 466
  • 543
41
votes
4 answers

How to include 10" and 7" layouts properly

Nexus 7: 7" 1280x800 Galaxy tab 10.1 10" 1280x800 I want my app to run on 7 and 10 inch tablets. As far as I know, I have to include these layout folders in my app: for 7 inch tablets layout-sw600dp layout-sw600dp-port for 10 inch…
berestom
  • 1,079
  • 2
  • 10
  • 9
1
2 3
75 76