title: How can I get pixel perfect layouts on Android devices?
body: <p>I have a custom component in my app where I extends a ViewGroup and add a bunch of rows (LinearLayouts) with data and a small border between them. This looks really good on HVGA screens but it looks terrible on QVGA screens.</p>
  
  <p>My problem is the parts where I want a 1 pixel border which works fine on HVGA but on QVGA some of the borders becomes either 2 pixels or 0 pixel (its only one of the two but I've seen both on different screen sizes). I make the border by having a black linear layout which I set padding to.</p>
  
  <p>I guess the problem has something to do with px vs dp as I seen the same thing before when I used px in my layout. But now that I'm trying to set the border size in code I can only put px, is there any way around this?</p>
  
  <p>I'm aware about the calculation you can do to get dp values in code but that doesn't really help me as I have to set integer values (so calculating the border will give me 1 or 2 for each row and it will still look bad).</p>