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);
}
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

相关文章
|
5月前
Threejs制作窗户透亮效果
这篇文章讲解了如何在Three.js中制作窗户的透亮效果,包括设置透明材质和光照以实现逼真的窗户渲染效果的技术细节。
120 1
|
5月前
Threejs制作海面效果
这篇文章详细介绍了利用Three.js制作逼真海面效果的过程,包括设置Water材质、调整光照及实现波动动画的步骤。
119 0
Threejs制作海面效果
Photoshop制作简洁清新的插画海报图片
Photoshop制作简洁清新的插画海报图片
83 0
|
JavaScript 程序员 开发者
跑马灯效果制作-上|学习笔记
快速学习跑马灯效果制作-上
115 0
跑马灯效果制作-上|学习笔记
|
JavaScript 开发者
跑马灯效果制作-下|学习笔记
快速学习跑马灯效果制作-下
117 0
跑马灯效果制作-下|学习笔记
|
移动开发 开发者 HTML5
制作一个表白网页|学习笔记
快速学习制作一个表白网页
制作一个表白网页|学习笔记
|
弹性计算 移动开发 开发者
制作一个表白网页
快速学习制作一个表白网页
制作一个表白网页
|
前端开发
一篇文章教会你如何制作精美导航条
一篇文章教会你如何制作精美导航条
621 0
一篇文章教会你如何制作精美导航条