Search code examples
androidandroid-galleryaspect-ratio

android gallery widget aspect ratio


I am using the gallery widget to display images:

<Gallery
    android:id="@+id/gallery"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/viewonline"
    android:layout_below="@+id/topbar_layout"
    android:layout_margin="10dp"
    android:spacing="10dp"
    android:unselectedAlpha="1.0">
</Gallery>

Its inside relative layout. Can someone please tell me how to have a good aspect ratio for this and how to set it? I am new to this thing. Thanks


Solution

  • Use Android:ScaleType tag in your xml, for your imageview you use inside the gallery.