Pinterest Style in Displaying Images with UIL

2019-05-31 00:32发布

问题:

Pinterest Style of Displaying Images is exceptional, and this adds beauty to your app. After a couple of research I found out that there are great libraries out there that can display images like Pinterest do but not sure if this is compatible with UIL.

I am using the Universal-Image-Loader in displaying my images. In the image shown below I got my images displayed in that manner with some views together with it. It is undeniably true that UIL library handles phone memory greatly in displaying a lot the images. I'd like to know if it is possible to display my images like the Pinterest's but still using UIL as the generator. What are the possible resolve to this approach? Or maybe another library that only handles the display and compatible with UIL.

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gridview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center"
    android:horizontalSpacing="4dip"
    android:numColumns="3"
    android:stretchMode="columnWidth"
    android:verticalSpacing="4dip"
    android:padding="4dip" />

Update:

I tried using the StaggeredGridView but the layout can't be cast to GridView.

 <com.origamilabs.library.views.StaggeredGridView
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:staggered="http://schemas.android.com/apk/res-auto"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/gridview"
        staggered:numColumns="3"
        staggered:drawSelectorOnTop="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

回答1:

Hey Check out my implementation of Pinterest type view using Staggered GridView and Universal-Image-Loader here.