TouchGFX 之 List Layout

List Layout

容器

  • List Layout控件时一个容器类,可以将相同类型的自定义的Container集中在一起,并进行上下或左右的滚动。

行为模式

A ListLayout itself does not have any notable impact on performance and is almost entirely dependent on its children. Therefore, the ListLayout is considered a very fast widget on most platforms.
意思是说,ListLayout本身没有什么行为,他只是一个容器,取决于其children的行为模式。

添加child

#include <gui_generated/screen1_screen/Screen1ViewBase.hpp>
#include <touchgfx/Color.hpp>

Screen1ViewBase::Screen1ViewBase()
{
   
    listLayout1.setDirection(touchgfx::SOUTH);
    listLayout1.setXY(90, 111);
	
	//box1.自定义的
    box1.setWidth(50);
    box1.setHeight(50);
    box1.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
    //添加
    listLayout1.add(box1);
    
    //在screen1view中添加listlayout1控件
    add(listLayout1);
}

属性

List Layout的属性可配置的非常少,原因是他的行为模式并不依赖自身,而是依赖于它装载的“child”。
一般我们只需要设置其Direction属性就好了,South是指上下滚动,East是左右滚动。
发现Location中的W和H是无法设置的,原因是List Layout容器会根据children的尺寸自动调整。
在这里插入图片描述

Child的设计

在官方的Demo例程中
在这里插入图片描述

主界面

发现在主界面的UI中,在list(List Layout) 控件下,并没有显示的添加ContainListElement,那么程序运行后,生成的界面的内容又是在哪里添加的呢?难道是在代码中显示的添加??
在这里插入图片描述

Text Resource

注意到在Text下的 Resource中有很多Resource ID,正好以list_element_xx开头,我们会在Generate Code中发现,这些Resource ID变成了“T_LIST_ELEMENT_xx
且上述枚举定义在“TextKeysAndLanguages.hpp”中
在这里插入图片描述</

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值