Using CocosStudio resources in Cocos2d-JS -- ListView and ScrollView

Source: Internet
Author: User

Using CocosStudio resources in Cocos2d-JS -- ListView and ScrollView

In this blog, we will briefly analyze the relationship between ListView and ScrollView, how to correctly use the two controls for design, and how CocosStudio currently supports the two controls.

I. Thoughts on ListView and ScrollView

1. Relationship between the two:

First, we need to know that ListView inherits from ScrollView. That is to say, based on ScrollView, ListView has refined some detailed functions. Some methods of ScrollView are available in ListView, while some methods of ListView are not necessarily available in ScrollView.

The official JS-Tests shows the two items almost the same, both of which display the list style of vertical and horizontal sliding. However, we need to know that ScrollView can achieve vertical and horizontal sliding at the same time.

2. Differences between the two:

Different sliding directions:
ScrollView can slide in four directions, but ListView can only achieve vertical or horizontal sliding.

The monitoring precision of the displayed controls is different:
ListView is often accurate to a specific Item, but ScrollView does not provide a convenient solution. Therefore, it can be seen from this that ListView is more suitable for displaying list information. This is also true in the examples on the official website. In contrast, ScrollView is more suitable for "big map" display. You can move the player window to view the content of the entire map.

CocosStudio supports different degrees:
In fact, it surprised me. Currently, CocosStudio does not provide sound support for ListView, as shown in:

You will find that many controls cannot be added. This makes great inconvenience to developers. (I hope the official website will support adding more controls earlier ...) However, let's take a look back. In fact, ListView is mainly used for displaying the list content, that is, displaying images and text. You can add buttons at most. I think it should be able to meet the general requirements of most developers. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Signature + signature/Signature + zb/Signature + zc/rvpk1p1_ape47/Signature + signature/fXy8rGsru21KOst7TV/Signature + signature + 7 nZzfi + signature + DQoJPHA + z + Signature + zb + qt8W24MHLo6zL5rHjxOPU9cO0zc + jrLa8v8nS1KGjzt7C28qyw7S/2Lz + Signature = "II final description"> Ii. Final description

In fact, the ListView seems to be able to add custom controls, but according to a netizen, it seems that they can only be customized in the Code and inherit widgets. After this operation, it seems that SelectedItem will not be able to judge, but also need to make its own judgment, because the specific operation is not very clear.
This series of tutorials mainly describes how to obtain the control in the IDE after CocosStudio is created. ListView does not seem to support detailed design in CocosStudio and can only be implemented in code. Therefore, we will not post code here. The ScrollView function can be implemented almost in CocosStudio design, and almost no code is required for further design. We will not go into details here.
Later, if you think it is necessary to create a ListView in the Code and operate the ScrollView, we will come up with a separate article to explain in detail how to operate it.

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.