Density on Android
<p>I'm trying to render custom buttons in Android. However, I'm having issues getting my bitmaps to render without scaling. I have a few constraints that are forcing me to forgo a few possible solutions. First, my bitmaps are being generated using a byte array through BitmapFactory; which I'm passing in bitmap options that specify inScaled=false for that. Second I must do everything in code, and am unable to use layout XML.</p>

<p>When I go to draw my custom button (which extends View), along with using the default behavior, I've tried calling <code>setDensity</code> on the canvas with both DENSITY_NONE and <code>bitmap.getDensity( )</code> (which is 160.) Despite this I can't get the bitmaps to render without scaling up. I've tried setting more options when creating my bitmaps (such as target density, screen density, etc.) However no combination of these has worked. This code 'fails' on the Samsung Galaxy S running 2.1 as well as HTC Droid Incredible on 2.1. When testing on an HTC Hero running 1.5 things work, but that was before the density stuff:/</p>

<p>Anyone out there have a suggestion?</p>

<p>Thanks!</p>

<p>Update:</p>

<p>I was a bit miss guided with my problem. It seems that the issue is with the underlying view. If I try to draw a normal line, I get scaling as well. This only happens in landscape, not portrait. Is there any way to disable the scaling between the two orientations?</p>
