kanzi笔记(六)电话簿滚动效果制作

简介: 先看成品效果图: 第一步:创建Grid List Box 3D, or Grid List Box 2D;2D就行了。

先看成品效果图:

 

第一步:创建Grid List Box 3D, or Grid List Box 2D;2D就行了。

第二步:

创建含有图片、名字和号码三个元素的模板。然后用这个模板创建电话簿列表。

创建完后会变成下面这样,这是因为默认的行和列的个数。

第三步:修改宽窄尺寸,使得呈现为列表显示。似乎修改grid的行数和列数应该也可以改为列表显示的。

第四步:设置起始和终止区域。

 

这样基本就可以了。在此基础上将text显示一样的项目,设置为bind。再添加page的跳转。就可以了。

下面是通过脚本的方式创建:

 
//To create a Grid List Box 2D:
// Create a Grid List Box 2D named MyListBox.
GridListBox2DSharedPtr gridListBox = GridListBox2D::create(domain, "MyListBox");
//To configure the grid area:
// Make each grid cell be a 100x100 square.
gridListBox->setCellWidth(100.0f);
gridListBox->setCellHeight(100.0f);
// Make the grid contain three rows that are filled column by column.
gridListBox->setHeight(300.0f);
gridListBox->setDirection(GridListBoxConcept::GridDirectionDown);
// Make the grid contain 10 columns. Items that are dragged beyond these columns are made invisible.
gridListBox->setWidth(1000.0f);
// Change the resting position when the list is scrolled to the beginning or end, so that items are not right at the grid edge.
gridListBox->setItemAreaBegin(0.2f);
gridListBox->setItemAreaEnd(0.8f);
//To add items to the list box:
// Create images and add them as items of the list box.
// Items on the grid appear in the order you add them to the list.
for (int i = 0; i < 5; ++i)
{
    Image2DSharedPtr item = Image2D::create(domain, "item" + to_string(i));
    item->setImage(item->acquireResource<Texture>(ResourceID("DefaultTexture")));
    // Make the images shrink to the cell size.
    item->setHorizontalAlignment(Node::HorizontalAlignmentStretch);
    item->setVerticalAlignment(Node::VerticalAlignmentStretch);
    gridListBox->addItem(item);
}
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

相关文章
|
6月前
|
前端开发 程序员
HTML+CSS+JavaScript制作动态七夕表白网页(含音乐+自定义文字)
一年一度的520情人节/七夕情人节/女朋友生日/程序员表白,是不是要给女朋友或者正在追求的妹子一点小惊喜呢,今天这篇博客就分享下前端代码如何实现HTML+CSS+JavaScript制作七夕表白网页(含音乐+自定义文字)。赶紧学会了,来制作属于我们程序员的浪漫吧!
232 0
|
9月前
如何利用 HBuilderX 制作图文混排的网页
如何利用 HBuilderX 制作图文混排的网页
370 3
|
9月前
|
图形学
如何在微信小游戏制作工具中做出好看的粒子效果?
如何在微信小游戏制作工具中做出好看的粒子效果?
152 1
|
9月前
微信小游戏制作工具中关于背景图的设置
微信小游戏制作工具中关于背景图的设置
279 0
Photoshop制作简洁清新的插画海报图片
Photoshop制作简洁清新的插画海报图片
83 0
|
JavaScript 程序员 开发者
跑马灯效果制作-上|学习笔记
快速学习跑马灯效果制作-上
115 0
跑马灯效果制作-上|学习笔记
|
JavaScript 开发者
跑马灯效果制作-下|学习笔记
快速学习跑马灯效果制作-下
116 0
跑马灯效果制作-下|学习笔记
|
移动开发 开发者 HTML5
制作一个表白网页|学习笔记
快速学习制作一个表白网页
制作一个表白网页|学习笔记
|
弹性计算 移动开发 开发者
制作一个表白网页
快速学习制作一个表白网页
制作一个表白网页
|
JavaScript
跑马灯效果制作-下
跑马灯效果制作-下
跑马灯效果制作-下