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
1
vote
1 answer

opencv real time video frame does not showing sobel output in android

I am new to opencv. I want to apply sobel filter on real time video using opencv in android but i am failed in doing so. when i use the built-in function of sobel in opencv it gives me the white blank screen.I have searched a lot but didn't find my…
Bisma
  • 95
  • 1
  • 6
1
vote
1 answer

Android WebView: Do CSS pixels always equal DIPs if width=device-width and scale=1.0?

I'm trying to get my mind around how to specify CSS dimensions in an embedded WebView in my app for Android 4.0 and higher. On the three devices I'm testing with (Nexus 4/7/10), it appears that if I use the following viewport directive:
Brian Rak
  • 4,912
  • 6
  • 34
  • 44
1
vote
1 answer

What means .0 dp in android?

For example textview with size 33.0 dp in xml. It means double number or it has other features?
Vahan
  • 3,016
  • 3
  • 27
  • 43
1
vote
1 answer

Programmatically set ImageView position in "dp"?

I've read: How to set margin of ImageView using code, not xml and the comment to use "You can scale the px value using context.getResources().getDisplayMetrics().density " Thing is, I have scale representing some values in colors, and need to point…
Balkyto
  • 1,460
  • 4
  • 22
  • 47
1
vote
1 answer

Widget size = (74dip*cells)-2 does not work in JellyBean

I have serious issues with my widget. I used this xml file:
Waza_Be
  • 39,407
  • 49
  • 186
  • 260
0
votes
2 answers

How to convert pixels to dp?

I am trying to create a simple android app in Java but I have hit a bump in the road. I have an Array List that contains many Bitmaps and I am drawing them to the canvas but I am using the measurement of pixels and that doesn't come out right on…
Peter Dempsey
  • 485
  • 1
  • 9
  • 17
0
votes
1 answer

Specifying Android boot up custom resolution (in DIP)

I am developing for several different screen sizes with different DIP. While it's not a problem with AVDs, I would like to test it on a real device. I have a large screen to which my board is hooked up to. But how can I boot Android up with a custom…
Hedge
  • 13
  • 2
0
votes
2 answers

Getting my bitmaps on a canvas to always be "full screen"

So I have this canvas on where I paint bitmaps An example would be a bitmap as a background.. so I will make this full screen on my 533x320 dip Samsung S2 So, when I load this same app on a, lets say, HTC with 480x320 dip.. my background image will…
0
votes
1 answer

Android : How to use DIP when the DIP resolution differs from device to device

I am really confused of the purpose with DIP on Android when the number of DIPs differs from device to device, even in the same size classed. (like medium displays) I am developing a game right now where I for an example is displaying a full screen…
Biskoppen
  • 37
  • 5
0
votes
1 answer

Understanding DIP for sprite movement / velocity

This is my first post, so I apologise in advance if I have done anything wrong here in asking my question. I've looked all over the net for a specific answer, but can't find one, so here goes..... I'm writing a game based on Surfaceview and so far,…
0
votes
0 answers

Android get Touch Position on a remote device and reflect the same position on server screen

Good wishes to all. I am having a situation where I have a streaming server,That runs a video (width = 1260, height = 690). I get this Url and play it in a WebView with random size (as of Android devices are with different resolution and…
0
votes
0 answers

how to change th value of layout in MainActivity.java?

i am using android studio in x.xml, i set the layout_height=400dp in MainActivity.java,i…
oscar
  • 11
  • 2
0
votes
1 answer

How can I know the pixels range for all screen densities in Android ? (base density of an image)

So imagine that I have an image that is 700x700 px in res folder and I want my app to support different pixel densities. So according to the documentation: ldpi -- 0.75x mdpi -- 1x hdpi -- 1.5x xhdpi -- 2.0x xxhdpi -- 3.0x xxxhdpi -- 4.0x So now, my…
0
votes
1 answer

Formula to convert any dpi to any dpi

I need the formulas to calculate any dpi to any dpi. For example: mdpi to hdpi, xdpi to xxhdpi, etc. This website exactly does what I require but I am not able to find the logic for it. Any suggestions on what will be the formula for it?
Joshua
  • 1,167
  • 1
  • 14
  • 32
0
votes
0 answers

calculus of dp and actual dp doesn't match

i calculated the dp of a device (smallest width), in particular a google pixel 3 (440dpi 1080x2160), using the formula: px = dp*(dpi/160) the result was 392.72, so i created the file animator-sw390dp-xxhdpi to handle it, but it turns out that the…