• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Device indipendant pixel not working fine

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is my main xml file



i have several Virtual Devices.i used dp for height and width.but when i run this in several devices it shows the button in different sizes.please find the attachment.
 
Maneesh Godbole
Saloon Keeper
Posts: 11341
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:
i have several Virtual Devices.i used dp for height and width.but when i run this in several devices it shows the button in different sizes.please find the attachment.


. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels

http://developer.android.com/guide/practices/screens_support.html
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to below url when we use dp,it shows same size in different screens.please find the attached screenshot.

http://www.youtube.com/watch?v=gd_7wKZiuW0&index=35&list=PLonJJ3BVjZW6hYgvtkaWvwAVvOFB7fkLa
resolution.png
[Thumbnail for resolution.png]
file
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic