Hy there, i am writing an application in which a Bitmap is loaded from the Gallery and displayed in a ImageView. I am using the following XML for the ImageView:
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:padding="3dp"
android:background="@drawable/back"
android:contentDescription="@string/contentDis"/>
My Target here is to center the ImageView horizontally and it should fit the dimensions of the loaded Bitmap (with a border from the background resource). But there seems to be a Problem: While this works for most Images some, especially those who have a much greater width than height aren't displayed. The ImageView shows the background only. I have already tried different scaleTypes but nothing solved the issue. But when i change the width of the ImageView in XML to fill_parent the Image is displayed. Why does this happen and how to solve this issue?