This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Murach's Java Programming and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Device indipendant pixel not working fine  RSS feed

 
sam liya
Ranch Hand
Posts: 1258
  • 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
Bartender
Posts: 11445
18
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: 1258
  • 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
 
Those are the largest trousers in the world! Especially when next to this ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!