开发者

Gallery with different image sizes

I have a gallery with different image sizes the custom layout is below for Gallery, its working correctly if the image width is les than height but if image height is less than width its not working correctly.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingLeft="5dip"
    android:paddingRight="5dip"
    android:focusable="true">
    <ImageView
        android:id="@+id/image"
        android:layout_width="60dip"
        android:layout_height="80dip"
        and开发者_JS百科roid:adjustViewBounds="true" 
        android:scaleType="centerCrop"
        />
    <TextView
        android:layout_below="@+id/image"
        android:id="@+id/text"
        android:textColor="#FFFFFF"
        android:layout_width="60dip"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:gravity="center" />
</RelativeLayout>

But its not maintaining the aspect ratio, I am stuck to it why its not working as desired

Update:

Gallery with different image sizes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜