ScrollView nested GridView with damping rebound effect, scrollviewgridview

Source: Internet
Author: User

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.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.