Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Image displayed at Webview from Url with high quality loss

I want to display an image from an url with an Webview at Android.

With Android phones with Version 1.5 and 1.6 there is no problem. but the same pic and the same code on an AndroidPhone with Version 2.0 and the pic is totaly pixelated.

Like Android is resizing the image first to a smaller one and then resizing it back to "normal" size.

Unfortunately its important to display the pic without any quality loss.

I tried to integrate it in the sourcefolder to show it as an normal image, but at Android 2.0 i get an exception because the image is to big. (At Android 1.6 there is no problem)

Any ideas how i can display the image without quality loss with Android 2.0 ?

like image 650
Merlino Avatar asked Mar 17 '10 09:03

Merlino


2 Answers

If you have not already done it, add this to your manifest :

 <supports-screens
      android:largeScreens="true"
      android:normalScreens="true"
      android:smallScreens="true"
      android:resizeable="true"
      android:anyDensity="true" />

Without this, everything will be scaled.

Also, if you dont want your device/emulator to scale your drawables you have to create drawables for each density by putting a higher resolution version into hdpi folder

res/drawable-ldpi/my_icon.png       // icon image for low density
res/drawable-mdpi/dpi/my_icon.png   // icon for medium density
res/drawable-hdpi/my_icon.png       // icon image for high density
like image 177
Vidar Vestnes Avatar answered Nov 15 '22 06:11

Vidar Vestnes


Use android:resizeable="true" instead of android:resizable="true". There is a missing "e".

like image 30
Klaus Avatar answered Nov 15 '22 06:11

Klaus