I\'ve got a linear layout and an image...
Technically both answers above are correct, but since you are setting your ImageView to fill_parent
instead of wrap_content
, the image within is not centered, but the ImageView itself is.
Give your ImageView the attributes:
android:scaleType="centerInside"
android:gravity="center"
The scaleType is really only necessary in this case if the image exceeds the size of the ImageView. You may also want different scaleTypes. In conclusion, android:gravity
is what you're looking for in this case, but if your ImageView is set to wrap_content
, you should set the ImageView's gravity (android:layout_gravity
) to be centered within the parent.