1

I am working on Grid View, where I am in a need to click and select an image by showing a small image over it. As you can see in the image attached, the green mark over the images shows they are selected. This is not possible with Normal Grid view. I have tried this.

Please suggest me.

enter image description here

Sam-In-TechValens
  • 2,501
  • 4
  • 34
  • 67

2 Answers2

2

Guys from google have already done everything for you to solve your problem so, you got to use ActionMode in your Activity and fill up your gridView.

http://developer.android.com/guide/topics/ui/menus.html#context-menu

so when you entering ActionMode just set your gridView object in ChoiceMode-> Multiple.

in your code:

GridView gv=new GridView(this) or this.findViewById(R.id.ma_grid_view);
GridAdapter adapter...
gv.setAdapter(adapter)
beginActionMode(); // this might be used by a long press or by button tam in action bar...

public void beginActionMode(){
    gv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}

kinda like this, read the article i'v send you spend some houres and you'll reach it... thanks.

Alex
  • 1,416
  • 1
  • 14
  • 24
1

for that you have to create custom adapter and make layout for your grid item,in layout use relative layout or framelayout.

using these you can overlap your images

here are some link for your help custom adapter

cusotm adapter

custom adapter for gridview in android

Community
  • 1
  • 1
Iftikar Urrhman Khan
  • 1,131
  • 1
  • 10
  • 21