android - ImageView diffrent scale types for orientation -


i use imageview has display after following rules:

  • always show full width landscape , portrait images -this works now
  • if image landscape image center in screen - works
  • if image portrait show top - don't cut top - not work

from xml file

    <imageview         android:id="@+id/myimage"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentleft="true"         android:layout_centervertical="true"         android:contentdescription="@null"         android:scaletype="centercrop" /> 

can set properties image show correct if portrait or landscape image?

you may subclass imageview, use matrix scaling , override setframe method. depending on image size - whether has portrait or landscape orientation - apply different matrix. please find example implementation here aligns image bottom edge , crops off top. similar requirements might starting point further adjustments.


Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -