I have problem when I try to display the image with full size. I tried to display image with wrap_content. But it is smaller real image.
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/screen1_logo" />
I go to the properties of this image and see some information: dimentions 211 x 74. Then I try to display image with fixed width and height. I see it's bigger.
<ImageView
android:layout_width="211px"
android:layout_height="74px"
android:src="@drawable/screen1_logo" />
is it right way? do we must to fix size to display image with full size?
Please help me to explain and resolve this problem.
add a scaleType to your ImageView
<ImageView
android:scaleType="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/screen1_logo" />
from the doc android:scaleType="center"
Center the image in the view, but perform no scaling.
Try adding a scaleType attribute to your view:
android:scaleType=""
The available options can be found here:
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
You are probably looking for scaleType
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
Please Define scale type as fitXY
<ImageView
android:id="@+id/yourImageViewId"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
Try adding in xml file (ImageView properties) android:adjustViewBounds="true".
<ImageView
android:id="@+id/photoViewer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
来源:https://stackoverflow.com/questions/17564753/how-to-display-an-image-full-size-with-imageview