rank
rank

Reputation: 83

Add text below the image in staggered gridview

I am implementing staggered gridview in one of my app. I am following this tutorial (http://www.technotalkative.com/lazy-productive-android-developer-part-6-staggered-gridview/). but what i want is, adding the text below the image. So can you please tell me how to accomplish this..? I've googled around but cant able to find the right answer.

Thanks in advance.

Upvotes: 0

Views: 818

Answers (2)

Jack
Jack

Reputation: 1855

  private List<ItemObjects> getListItemData(){
    List<ItemObjects> listViewItems = new ArrayList<ItemObjects>();
    listViewItems.add(new ItemObjects("Alkane", R.drawable.one));
    listViewItems.add(new ItemObjects("Ethane", R.drawable.two));
    listViewItems.add(new ItemObjects("Alkyne", R.drawable.three));
    listViewItems.add(new ItemObjects("Benzene", R.drawable.four));
    listViewItems.add(new ItemObjects("Amide", R.drawable.one));
    listViewItems.add(new ItemObjects("Amino Acid", R.drawable.two));
    listViewItems.add(new ItemObjects("Phenol", R.drawable.three));
    listViewItems.add(new ItemObjects("Carbonxylic", R.drawable.four));
    listViewItems.add(new ItemObjects("Nitril", R.drawable.one));
    listViewItems.add(new ItemObjects("Ether", R.drawable.two));
    listViewItems.add(new ItemObjects("Ester", R.drawable.three));
    listViewItems.add(new ItemObjects("Alcohol", R.drawable.four));

    return listViewItems;
}

try this http://inducesmile.com/android/android-staggeredgridlayoutmanager-example-tutorial/

Upvotes: 1

Paresh Mayani
Paresh Mayani

Reputation: 128448

Steps:

  1. Download given source code.
  2. Include TextView inside row_grid_item.xml which is Step-3 given in tutorial.
  3. Do operations on any views inside getView() method of custom adapter. Even you can include any views inside custom row layout file and do operations onto it.

(BTW, thanks for referring my article, I am glad!)

Upvotes: 1

Related Questions