imageview - How do I display this image in Android? -


how display image following configuration in android?

  • retain original aspect ratio (the image can scaled, not stretched)
  • fill width of parent
  • aligned bottom of parent

the following not work:

<imageview android:layout_width="fill_parent"  android:layout_height="wrap_content" android:scaletype="fitcenter" android:layout_alignparentbottom="true" android:src="@drawable/background" /> 

using above xml imageview takes width of parent, image inside imageview not.

some points. if want manteint aspect ratio instead of fitcenter should try centerinside:

scale image uniformly (maintain image's aspect ratio) both dimensions (width , height) of image equal or less corresponding dimension of view (minus padding).  

remember devices using application might have different screen sizes. if background image can stretched recommend try ninepatchdrawable


Comments

Popular posts from this blog

SAP Web Service from .NET via WCF -

Optimized Line drawing in QT -

datetime - str to time in python -