First of all, I want to apologize in advance since I'm sure that this kind of question has been asked before, but even though I was looking for about 2 weeks at those questions I could not figure out what I'm doing wrong.
This is where I load the image in the activity:
ImageView image = (ImageView) findViewById(R.id.shop_Image) ;
image.setScaleType(ImageView.ScaleType.CENTER_CROP) ;
String mDrawableName = data.vec.elementAt(id).fuenf ;
if ( mDrawableName.equals("leer") )
mDrawableName = "ic_launcher" ;
int resID = getResources().getIdentifier(mDrawableName , "drawable", etPackageName());
image.setImageResource(resID) ;
And this is the xml-file:
<LinearLayout
android:id="@+id/shop_Layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FDFDFD"
android:orientation="vertical" >
<ImageView
android:id="@+id/shop_Image"
android:contentDescription="@string/shop_image"
android:layout_width="match_parent"
android:layout_height="400dp"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/ic_launcher" />
[...]
And these are the results:
On a Galaxy Nexus, Nexus 5 or Samsung S3 it looks like this:
And on a Razr I or HTC Desire X it looks like this:
I'm aware that the above devices, which display the image correct have a display with at least 4,7 inches while the both with the blurry images have 4,3 inches or 4 inches.
And even though I have put those images in the different drawable folders, I still get these unpleasant results.
If further code-examples are needed, please let me know.
PS: Sorry for the missing highlighting, I'm still a newbie :)
The most common reason for a blurry photo is an incorrect use of shutter speed. The faster your shutter speed is, the less chance there is for camera shake. This is particularly true when shooting handheld. There is no way that anyone will be able to handhold a camera steady enough at slow shutter speeds.
One of the biggest culprits of blurry photos is camera shake. This happens when the phone moves too much while the picture is being taken, resulting in motion blur on the object you are photographing.
Your iPhone has a setting that limits the resolution and quality of an image sent from iMessage. The iPhone does that to save storage space and internet bandwidth. However, this can cause blurry images in some instances.
Once you send something via SMS, your carrier gets involved and that data gets terribly compressed. While data compression affects all images and videos, it typically impacts larger or high-quality images the most. Videos are also heavily affected, and usually, end up extremely blurry and unwatchable.
A quick search on Google let me know these facts:
Desire X specs: 480 x 800 pixels, 4.0 inches (~233 ppi pixel density)
- So, it's an hdpi
device
Samsung S3 specs: 720 x 1280 pixels, 4.8 inches (~306 ppi pixel density)
- So, it's an xhdpi
device
Now, you should read this: developer.android.com/guide/practices/screens_support.html.
A very quick fix could be: put the image in the /res/drawable-xhdpi
folder (if you don't have the folder, just create it).
Also consider that:
The images should be saved at the proper dpi resolution.
A common error is to leave them at the standard (insufficient) resolution of 72 dpi or 96 dpi.
hdpi
images resolution should be 240 dpi and xhdpi
images resolution should be 320 dpi, to display properly and scale well.
So, what to do?
Change the resolution of the bigger image, without changing its size (which is automatically scaled when you touch the resolution - so, reset it to 1280*800).
Then make the smaller image out of this one, by changing the resolution (it should scale down to the correct size 480*854 - just cut out the exceeding 54 pixel - 27 from the top and 27 from the bottom).
Once you put the right images into their proper folders, everything should now fit well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With