4

I do lots of google and found many examples and also explore that but ~I want AsymmetricGridView different No of images and different images sizes in my grid.

Please find below attached images for my requirement of grid.!

enter image description here

Please help me for the this type of grid or suggest me library for the this type of asymmetric grid.

Thanks in advance.

Yasin Kaçmaz
  • 6,573
  • 5
  • 40
  • 58
Arvind Kanjariya
  • 2,089
  • 1
  • 18
  • 23

2 Answers2

2

You can use following library https://github.com/felipecsl/AsymmetricGridView

enter image description here

Sharjeel
  • 15,588
  • 14
  • 58
  • 89
2

You can use THIS LIBRARY to achieve your goal.Import this lib in your eclipse workspace or include in your gradle if you are using Android Studio

In your build.gradle file:

dependencies {
    compile 'com.felipecsl.asymmetricgridview:library:2.0.1'
}

In your layout xml:

<com.felipecsl.asymmetricgridview.library.widget.AsymmetricGridView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

In your activity class:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    listView = (AsymmetricGridView) findViewById(R.id.listView);

    // Choose your own preferred column width
    listView.setRequestedColumnWidth(Utils.dpToPx(this, 120));
    final List<AsymmetricItem> items = new ArrayList<>();

    // initialize your items array
    adapter = new ListAdapter(this, listView, items);
    AsymmetricGridViewAdapter asymmetricAdapter =
        new AsymmetricGridViewAdapter<>(this, listView, adapter);
    listView.setAdapter(asymmetricAdapter);
}
Anirudh Sharma
  • 7,968
  • 13
  • 40
  • 42
  • I tried this but according to my question second and third row is not possible in this library.Can you please let me know this thing is possible according to my requirment – Arvind Kanjariya Jul 21 '15 at 04:32
  • I have seen this library on github and this is exactly what i required but I am not able to follow how to use his library for loading dynamic images.. In my project images are fetched from server.So i am getting url of images from server.I can store them in list but how to implement it with AsymmetricGridView.can u hep me wid this-http://stackoverflow.com/questions/31792625/displaying-dynamic-images-in-asymmetricgridview – Android Developer Aug 03 '15 at 16:56
  • @BhuvneshVarma.if you closely analyse the library and see AsymmetricGridViewAdapter has extended BaseAdapter.So it's like a normal GridView.Just fetch your data,pass it to your adapter and use an image loading library such as Picasso(http://square.github.io/picasso/) to load your item in your image view. – Anirudh Sharma Aug 04 '15 at 04:24
  • @BhuvneshVarma well i haven't used this lib in particular.but can you post some image or something to clarify it? – Anirudh Sharma Aug 05 '15 at 05:21
  • try with select 2 Column that will show some BLANK cell :( – Ajay Pandya Aug 31 '15 at 12:29
  • 1
    I also try this library but it force close app with error after setting adaper.with error - Attempt to invoke interface method 'int com.felipecsl.asymmetricgridview.library.model.AsymmetricItem.getRowSpan()' on a null object reference. Any help please – Ravi Bhandari Apr 05 '16 at 17:36