Select muiltiple images from the gallery

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

It should look something like this:

gallery view

the screen looks like http://i.imgur.com/qAO0Q.jpg

+6
source share
3 answers

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

Check out this example: Android Custom Image Gallery with a checkmark in the grid to select multiple

+1
source

Problems in your design:

Making a selection by dragging your thumbs on both sides will become an additional headache. First of all, scroll processing when making selections. Secondly, the handling of touch / drag and the decision to include the element in the selection or not.

Design Change:

Let me suggest an easier way to expand the selection rectangle :

I assume that the selection begins with a long click on any item. An orange rectangle appears on this starting element. Then one crane on any adjacent element should include all elements located between the pressed and the initial element, including the involved one. This will greatly simplify and reduce errors.

Implementation:

Now this design should not be too complicated to implement. Expand the gallery widget and you have members that indicate whether the selection is being made and what the selection range is ( startIndex and endIndex ). Override the onDraw method and draw a selection rectangle from startIndex to endIndex .

+5
source

What can you do:

  • Gives the identifiers of all the images in a slide show.
  • Use javascript to install
  • onclick events for images Enable onclick event borders

Add tags to img

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

Create a script launch event that changes the namespace of the selected identifier.

Enable css to enable borders:

 .clicked{ border-style:solid; border-width:3px;} 
+1
source

Source: https://habr.com/ru/post/913305/


All Articles