ScrollView nested GridView with damping rebound effect, scrollviewgridview
I have written a ScrollView with damping and rebound effect before, but there are some minor problems, so I reorganized it. This article is a Scrollview with damping, the nested GridView Implementation of Scrollview also inherits the automatic adaptation screen size mentioned in the previous article. We can refer to the effect of Momo first:
Let's look at the results of this article:
The images loaded in the demo are obtained from the network using afinal. In order to achieve the effect, we also provide a reference for loading network images. The usage of afinal is as follows, as mentioned in the previous articles,
Notes are also more detailed in the demo, you can download the demo reference: http://download.csdn.net/detail/baiyuliang2013/8048965
How to display a nested GridView in android ScrollVIew
In Android development, ScrollView nested GridView or ListView is often used. Because both controls have built-in scroll bars, when they are used together, the problem that the GridView or ListView displays is incomplete. Custom MyGridViewpublic class MyGridView extends GridView {public MyGridView (Context context) {super (context);} public MyGridView (Context context, AttributeSet attrs) {super (context, attrs );} public MyGridView (Context context, AttributeSet attrs, int defStyle) {super (context, attrs, defStyle) ;}@ Overridepublic void onMeasure (int widthMeasureSpec, int detail) {int expandSpec = MeasureSpec. makeMeasureSpec (Integer. MAX_VALUE> 2, MeasureSpec. AT_MOST); super. onMeasure (widthMeasureSpec, expandSpec) ;}} layout file in xml: <com. xxx. myGridViewandroid: id = "@ + id/mygridview" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: gravity = "center" android: horizontalSpacing = "5dp" android: numColumns = "4" android: stretchMode = "columnWidth"
Scrollview nested gridview sliding occurs stuck phenomenon, how to solve
In fact, it is a pre-loading process. You should not load them all at once. When your screen is static, you may secretly pre-load 5-10 views of data. The reason for the slow speed is that the temporary loading of data is too much. The concept is similar to double buffering.