GridImageView

Introduction: 提供一个继承自 ScrollView 的网格图片控件,可以很方便的以网格的方式显示图片,并且可以无缝切换至任意一种图片加载方式,控件内置一个 Zoom Animation,用于图片的单击放大效果
More: Author   ReportBugs   
Tags:
GridImageView-网格图片-

中文说明

Provide a grid ImageView, according to the image of the incoming address automatically load. Unlimited image loading frame, you can switch to any one of the ways you like.

usage

compile 'com.wenen:gridimageview:1.0.7'

1. implements the callback in the Activity:

public class MainActivity extends AppCompatActivity implements LoadImageCallBack{
  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
  }
}
#### 2. get the view:
gridImageView = (GridImageView) findViewById(R.id.images);

3. set the list size of ImageUrl

gridImageView.setImage(list.size(), this,context);

4. Override the callback to load image and add a listener

@Override
  public void loadImage(ImageView imageView,int index) {
    //load your image
  }
  @Override
  public void onClickResponse(ImageView view,int index) {
    //add the ClickListener of your ImageView
  }

XML:

<com.wenen.gridimageview.GridImageView
      android:id="@+id/images"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
/>

Load image in the Activity and set a zoom animation:

  @Override
  public void onClickResponse(ImageView view, int index) {
    Glide.with(this).load(list.get(index)).into(imageView);
    gridImageView.zoomImageFromThumb(view, imageView,
        (FrameLayout) findViewById(R.id.activity_main));
  }

XML(tips:if you want to set a zoom animation,the xml root must be FrameLayout):

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.wenen.gridimageviewsample.MainActivity"
    >
    <com.wenen.gridimageview.GridImageView
        android:id="@+id/images"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
  <ImageView
      android:id="@+id/expanded_image"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:contentDescription="@string/description_zoom_touch_close"
      android:visibility="invisible"
      />
</FrameLayout>
Support Me
Apps
About Me
Google+: Trinea trinea
GitHub: Trinea