Questions tagged [density-independent-pixel]

DIP is short for Density Independent Pixel. It is used by the Android system as a unit of measurement to make GUIs fit on different screen sizes with scaling. This allows the developer to create a single interface for different screen sizes.

119 questions
2
votes
1 answer

Issue with DP calculation on 7" tablet & 7" tablet emulator

I am having some problems with the dp calculation for a 7" tablet (800x480px). Below is my way of calculating. Can't find where I am making a mistake in calculation or my thought: I have three devices that I'm testing: Nexus One: 800x480px, 3.7"…
Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192
2
votes
0 answers

DPI for picture sizing in Android

If I have a "picture.png" which is 100px - 100px 72dpi (dot per inch) and is set in the drawable folder, if I want to supply a "picture.png" for HighDensity (hdpi) is it enough I change in photoshop the size in 150px - 150px keeping 72dpi or do I…
wocmultimedia
  • 259
  • 1
  • 6
  • 18
2
votes
3 answers

Android actual auto-scaling width/height parameters?

I was under the impression that 'dip' (Density Independent Pixel) values were the android solution to using % values to determine the width and height of layout elements. I thought this was an upgrade to using static 'px' (pixel) values or other…
CQM
  • 42,592
  • 75
  • 224
  • 366
2
votes
3 answers

Should I use dip, dp, sip or sp for text formatting?

I wouldn't say my app is text heavy...but it displays random strings sometimes that are longer than others. They fit fine on my droid 2, but I know they won't display the same on smaller droids. Does anyone know the proper way of formatting…
Sapp
  • 1,793
  • 7
  • 29
  • 51
2
votes
1 answer

Use dp width in PercentRelativeLayout

When I try to add a view without "widthPercent" or "heightPercent" in a PercentRelativeLayout, the view doesn't show up. The reason why I want this is to add a divider between the 2 elements of my PercentRelativeLayout with a width of 1dp. The…
MHogge
  • 5,408
  • 15
  • 61
  • 104
2
votes
3 answers

TextView is on different heights on different resolutions. DIP doesn't work

The bottom property of below textView scales wrong, the TextView is on a different height on every Android device: See attached pictures. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { …
2
votes
3 answers

How to compute device independent pixel units?

I am assuming that the terminology Density-independent pixels and Device-independent pixels, have same meaning. Density-independent pixels(dip) are a virtual pixel unit, equivalent to one physical pixel on a 160dpi (MDPI) screen. 4dip is equivalant…
overexchange
  • 15,768
  • 30
  • 152
  • 347
2
votes
4 answers

How to implement DIP in an MVC environment?

Dependency Inversion Principle states that higher level modules should not depend on lower level modules. Both should depend on abstractions. I do understand that principle. But as I'm using ASP.NET MVC, I often get my controller methods as: …
Jorge Zuverza
  • 885
  • 8
  • 26
2
votes
0 answers

Using Canvas to draw rectangles to fit in a specified width screen

Using the code given below we can retrieve the height and the width of a particular screen size : DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); float dpHeight = displayMetrics.heightPixels /…
Arjun Issar
  • 672
  • 4
  • 13
  • 32
2
votes
1 answer

Velocity Tracker accounting for screen pixel density

When using Android's VelocityTracker to track MotionEvents, is it necessary to account for screen density to return the "density independent velocity"? velocityTracker.computeCurrentVelocity(1); // pixels per milliseconds float velocityY =…
mdupls
  • 2,012
  • 1
  • 27
  • 40
2
votes
3 answers

Android: Using AdMob with less than 320dip width

I'm displaying my app within a dialog. The dialog doesn't cover the full screenwith (at least 320dip). Therefore, using AdMob is a bit of a problem, because all AdSizes I've seen take up at least 320dip width. So my question is: is there a…
Xander
  • 5,487
  • 14
  • 49
  • 77
2
votes
3 answers

How to get Image DPI in PHP

I am searching for the code which could help me to get the Image DPI in PHP. Could any one look into this ? Thanks in advance.
John Smith
  • 215
  • 3
  • 4
  • 10
2
votes
2 answers

How to draw a circle of the same physical size on different Android devices?

I have defined a circle radius dimension in a resources file like so: 15dp And then I draw the circle in a custom View like this: Resources res =…
2
votes
2 answers

Android - canvas drawBitmap and different resolutions?

I have this issue with drawing for example two bitmaps on canvas(it's for the live wallpaper). Thing is that small bitmap that is at front should be placed exactly in right place of the background bitmap. It looks good on emulator of course (let's…
1
vote
1 answer

Should I use or avoid independent-density pixels in android animated game development?

My question is: Does the DIP "engine" kill performance? How it would perform for bitmap sprites and how for drawing polygons? If I should avoid this: is it any good guide how to handle multiple physical resolutions and densities?
ardabro
  • 1,907
  • 16
  • 31