how to draw custom gallery in android

I want to develop an app based on the image in which thumbnails can move from top to bottom and left to right simultaneously.

please refer the image where gray parts are the thumbnails. I want to know from where i can start

Looking for the help

Answers


I think that you do not need to handle the scroll of both the views, but just move the items from one view to another. The below snippet moves children from the horizontal scroll view to the vertical scroll view.

int[] xy = new int[2];

// horizontalComponents contains all the children of the 
// horizontal scroll view, this statement reads the location
// of the ith child of the view.
horizontalComponents[i].getLocationInWindow(xy);

// Check for some limit of the x-coordinate
if (xy[0] < 58) {
    // Linear layout in horizontal scroll view & 
    // vertical scroll view respectively
    hrzChild.removeView(horizontalComponents[i]);
    vertChild.addView(horizontalComponents[i]);
    hrzScroll.fullScroll(HorizontalScrollView.FOCUS_LEFT);
    vertScroll.scrollTo(0, 0);
}

I've put this snippet in the onScroll method of a gesture listener of the horizontal scroll view.

I hope it helps..


Need Your Help

Splitting comma delimited csv file with inline commas

c# asp.net vb.net csv .net

I am splitting up a comma delimited CSV-file by using

PHP DOMDocument: what is the nicest way to safely add text to an element

php xml special-characters domdocument

When adding a string that might contain troublesome characters (eg &amp;, &lt;, >), DOMDocument throws a warning, rather than sanitizing the string.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.