How about the waterfall, I don't introduce more. Here are the two ways I think about it.
Method One, the overlay of the control:
Scrollview+linearlayout. Add a horizontal linearlayout in the ScrollView, add several vertical linearlayout in the horizontal layout, and then load and recycle the bitmap according to the sliding condition. can even recycle ImageView (recovery bitmap at the same time remove the ImageView, load bitmap while addview, need to grasp the location of the view), the idea is better realized.
Method Two, custom ViewGroup:
Load the picture, remember the picture information (width, height, url, etc.), and calculate the position of the picture should be placed, in ViewGroup add ImageView used to display the picture, then realize ViewGroup OnLayout method, In the OnLayout method, the Imageview.layout () method is called based on the computed picture position information. Picture arrangement, need to handle the slide, in the Ontouch event to use Scrollby/scrollto to achieve the effect of sliding, at the same time can be action_up inside to deal with the effect of sliding rebound fling. It is important to note that ViewGroup does not intercept the touch event by default. Here, you need to override the Onintercepttouchevent method so that it returns true to intercept the touch event.
Two ways to realize waterfall flow in Android