Lazylist Layout

2019-09-05 10:28发布

问题:

I created my own Lazylist which originally created by Fedor here(Lazy load of images in ListView). I am trying to make my own custom Layout which looks like the image below. Is there anyway to accomplish this?

回答1:

modify your item.xml like this way

<RelativeLayout android:layout_height="55sp"
        android:layout_width="fill_parent" android:padding="5sp" android:layout_marginLeft="6sp"
        android:layout_marginRight="6sp" android:layout_marginBottom="3sp"
        android:layout_marginTop="3sp">         
    <ImageView android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true" android:layout_marginRight="6dip"
        android:id="@+id/image" android:layout_height="50sp"
        android:layout_width="50sp" android:src="@drawable/icon"/>
    <TextView android:id="@+id/title" android:layout_width="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true" android:ellipsize="marquee"
        android:layout_toRightOf="@+id/image" android:maxLines="1"
        android:gravity="center_vertical" android:layout_height="wrap_content" android:text="Hello"/>
    <TextView android:layout_width="fill_parent"
        android:id="@+id/desc"
        android:layout_alignParentRight="true" android:layout_alignParentTop="true"
        android:layout_above="@+id/title"
        android:layout_alignWithParentIfMissing="true" android:gravity="center_vertical"
        android:textStyle="bold" android:layout_toRightOf="@+id/image"
        android:layout_height="fill_parent" android:textSize="15sp" android:text="Title"/>
</RelativeLayout>