Selection of multiple images from gallery view
Asked Answered
S

3

6

I want to create a gallery view, in which I want to select multiple images using an orange rectangular box.

It should look something like the following:

gallery view

screen look like https://i.sstatic.net/FsNAa.jpg

Stringent answered 16/4, 2012 at 9:1 Comment(2)
Have you tried any code? Please provide code, so SO users will help you.Outfall
I feel like you want me to write an entirely new code for you for the shake of 100 points.Botheration
B
1

Then you can define a custom adapter for your GalleryView, define a row XML layout file with ImageView and CheckBox and inflate this XML layout inside the custom adapter class. FYI, you will define custom adapter class by extending BaseAdapter class.

Check this example: Android custom image gallery with checkbox in grid to select multiple

Bootblack answered 16/4, 2012 at 9:5 Comment(6)
thanks for reply, but i want to select multiple images using a rectangle box, not using check box, In given picture the orange color box used to select multiple imagesStringent
what do you mean by rectangle box?Bootblack
Above picture there are a orange color box are used to select multiple imageStringent
How to solve this, I want to select multiple images using a orange frame of box which are showing?Stringent
After 2 month I am still do not get the output like this.Stringent
After 1 year I am still do not get the output like thisStringent
G
5

Issues in your design:

Doing the selection by dragging the thumbs on either sides is going to be an extra headache. First of all, handling scrolling while doing selection. Secondly, handling touch/drag and deciding whether to include an item in the selection or not.

Design change:

Let me suggest a simpler way to extend your selection rectangle :

I assume the selection starts with a long click on any item. The orange selection rectangle appears over this initial item. Then a single tap on any neighboring item should include all items placed in-between the tapped and the initial item including the tapped one. That will make selection handling significantly simpler and less buggy.

Implementation:

Now this design shouldn't be too difficult to implement. Extend the Gallery widget and have members that indicate whether a selection is in progress and what is the range of selection (startIndex and endIndex) . Override the onDraw method and draw the selection rectangle from startIndex to endIndex items.

Grapefruit answered 22/6, 2012 at 14:12 Comment(1)
Finally you had to settle for checkbox based solution.. Thats the best way to select a subset of items.Grapefruit
B
1

Then you can define a custom adapter for your GalleryView, define a row XML layout file with ImageView and CheckBox and inflate this XML layout inside the custom adapter class. FYI, you will define custom adapter class by extending BaseAdapter class.

Check this example: Android custom image gallery with checkbox in grid to select multiple

Bootblack answered 16/4, 2012 at 9:5 Comment(6)
thanks for reply, but i want to select multiple images using a rectangle box, not using check box, In given picture the orange color box used to select multiple imagesStringent
what do you mean by rectangle box?Bootblack
Above picture there are a orange color box are used to select multiple imageStringent
How to solve this, I want to select multiple images using a orange frame of box which are showing?Stringent
After 2 month I am still do not get the output like this.Stringent
After 1 year I am still do not get the output like thisStringent
D
1

What you could do:

  • Give ids all the images in the slide show
  • Use javascript to set
  • onclick events for the images Enable borders on the onclick event

Add to img tags

<IMG id=”1” namespace=”clicked” onclick="TriggerEvent(this)"></IMG>

Create script trigger event that changes the namespace of the selected id.

Include css to enable the borders:

.clicked{
border-style:solid;
border-width:3px;}
Dotterel answered 27/6, 2012 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.