Android – Align ImageView to top right of screen

androidandroid-layoutimageview

I've a imageView in my layout which serves as a background which doesn't scale. But I need to have my image in the topright corner of the screen. I now have my image in the top left corner of the screen. This is my xml for the imageview:

    <ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:src="@drawable/achtergrond"
android:scaleType="fitCenter" />

I also tried to put it in a linearlayout which has gravity="top|right" but that doesn't remove the white space around the picture because it's with the match_parent sizes. I also need to keep the scale of the picture, so I can't do fill_parent.

I hope someone can help me with this!

Best Answer

Maybe add

android:adjustViewBounds="true" 

to your ImageView? I had a similar problem.

Related Topic