BitmapDrawable with unexpected size in Android 2.0.1 WVGA854

I want to display a 480x320 JPEG file stored on an SD card in Android 2.0.1, with WVGA854 and 240 lcd density (Motorola Droid).

However, when I create BitmapDrawable via Drawable.createFromPath (), the resulting BitmapDrawable has the following meanings:

mBitmapWidth = 320

mBitmapHeight = 213

mTargetDensity = 160

The manifest includes the following configuration:

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
<supports-screens 
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
 anyDensity="true"
/>

Obviously, Android is resizing the bitmap. What could be causing this behavior? How can i avoid this?

Thanks in advance.

+3
source share
1 answer

Drawable.createFromPath() - , BitmapFactory . , , API 4 Android .

, BitmapDrawable.geBitmap(). getWidth() BitmapDrawable.geBitmap(). getWidth().

BitmapFactory BitmapFactory.Options.inScaled. API 4, , 3, , .

, SD- . , 320x213 160 () 480x320 240, , Drawable.createFromPath() 480x320 240 , 240 ?

+5

Source: https://habr.com/ru/post/1726777/


All Articles