样式属性(Style properties)
样式属性(Style properties)
大小与位置(Size and position)
Properties related to size, position, alignment and layout of the objects. 与对象的大小、位置、对齐方式和布局相关的属性。
宽度(width)
可以使用像素、百分比和LV_SIZE_CONTENT
来设置对象的宽度。百分比值与父对象的内容区域的宽度相关。
-
默认值(Default) 与部件相关(Widget dependent)
-
Inherited No
-
Layout Yes
-
Ext. draw No
最小宽度(min_width)
设置最小宽度。可以使用像素值和百分比值。百分比值与父对象的内容区域的宽度相关。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
最大宽度(max_width)
设置最大宽度。可以使用像素值和百分比值。百分比值与父对象的内容区域的宽度相关。
-
Default LV_COORD_MAX
-
Inherited No
-
Layout Yes
-
Ext. draw No
高度(height)
可以使用像素、百分比和LV_SIZE_CONTENT
来设置对象的高度。百分比值与父对象的内容区域的宽度相关。
-
Default Widget dependent
-
Inherited No
-
Layout Yes
-
Ext. draw No
最小高度(min_height)
设置最小高度。可以使用像素值和百分比值。百分比值与父对象的内容区域的宽度相关。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
最大高度(max_height)
设置最大高度。可以使用像素值和百分比值。百分比值与父对象的内容区域的宽度相关。
-
Default LV_COORD_MAX
-
Inherited No
-
Layout Yes
-
Ext. draw No
x
设置对象的x坐标,并需要考虑对齐 align
的方式. 可以使用像素值和百分比值。百分比值与父对象的内容区域的宽度相关。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
y
设置对象的y坐标,并需要考虑对齐 align
的方式. 可以使用像素值和百分比值。百分比值与父对象的内容区域的宽度相关。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
对齐方式(align)
设置对齐方式,该对齐方式告诉应从父节点的哪个位置来作为 X 和 Y 坐标的原点。 共有以下几种选项: LV_ALIGN_DEFAULT
, LV_ALIGN_TOP_LEFT/MID/RIGHT
, LV_ALIGN_BOTTOM_LEFT/MID/RIGHT
, LV_ALIGN_LEFT/RIGHT_MID
, LV_ALIGN_CENTER
。
LV_ALIGN_DEFAULT
代表 LV_ALIGN_TOP_LEFT
,即以左上角作为原点,LV_ALIGN_TOP_RIGHT
则是右上角作为原点。
-
Default
LV_ALIGN_DEFAULT
-
Inherited No
-
Layout Yes
-
Ext. draw No
变换宽度(transform_width)
此值会使对象变得更宽。 可以使用像素和百分比(lv_pct(x)
)值。 百分比值相对于对象的宽度而言。
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
变换高度(transform_height)
此值会使对象在两侧变得更高。 可以使用像素和百分比(lv_pct(x)
)值。 百分比值相对于对象的高度而言。
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
变换x坐标(translate_x)
沿x方向移动对象,在完成布局、对齐和其他定位之后使用。 可以使用像素和百分比(使用 lv_pct(x)
)值。 百分比值相对于对象的宽度而言。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
变换y坐标(translate_y)
沿y方向移动对象,在完成布局、对齐和其他定位之后使用。 可以使用像素和百分比(使用 lv_pct(x)
)值。 百分比值相对于对象的高度而言。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
缩放(transform_zoom)
与图片缩放类似, 与对象的属性进行相乘。256(或者 LV_IMG_ZOOM_NONE
)是普通尺寸,128则缩放到原来的一半,512则是放大一倍,以此类推。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw Yes
变换角度(transform_angle)
与旋转图片类似类似地旋转对象,1代表0.1度,则 45 度 = 450
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw Yes
填充(Padding)
用于描述父级与子级之间以及子级之间间距的属性。 非常类似于 HTML 中的填充属性。
顶部填充(pad_top)
在顶部设置填充。 它使这个方向的内容区域变得更小。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
底部填充(pad_bottom)
在底部设置填充。 它使这个方向的内容区域变得更小。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
左部填充(pad_left)
在左部设置填充。 它使这个方向的内容区域变得更小。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
右部填充(pad_right)
在右部设置填充。 它使这个方向的内容区域变得更小。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
行填充(pad_row)
设置行之间的填充。 在布局时使用。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
列填充(pad_column)
设置列之间的填充。 在布局时使用
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
背景(Background)
用于描述对象的背景颜色和图像的属性。
背景颜色(bg_color)
Set the background color of the object.
-
Default
0xffffff
-
Inherited No
-
Layout No
-
Ext. draw No
bg_opa
设置背景的不透明度。0
, LV_OPA_0
或 LV_OPA_TRANSP
意味着完全透明, 256
, LV_OPA_100
或 LV_OPA_COVER
意味着不透明, 其他值或 LV_OPA_10
、LV_OPA_20
等表示半透明。
-
Default
LV_OPA_TRANSP
-
Inherited No
-
Layout No
-
Ext. draw No
渐变色(bg_grad_color)
设置背景的渐变色. 只有在 grad_dir
不是 LV_GRAD_DIR_NONE
时生效。
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
渐变方向(bg_grad_dir)
设置背景渐变的方向. 有三个值 LV_GRAD_DIR_NONE/HOR/VER
.
-
Default
LV_GRAD_DIR_NONE
-
Inherited No
-
Layout No
-
Ext. draw No
背景色起点(bg_main_stop)
设置背景色的起点。 0 表示顶部/左侧,255 表示底部/右侧,128 表示中心,依此类推
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
背景渐变色起点(bg_grad_stop)
设置背景渐变颜色的起点。 0 表示顶部/左侧,255 表示底部/右侧,128 表示中心,依此类推
-
Default 255
-
Inherited No
-
Layout No
-
Ext. draw No
背景图片(bg_img_src)
设置背景图像。 可以是指向 lv_img_dsc_t
的指针、文件路径或LV_SYMBOL_...
-
Default
NULL
-
Inherited No
-
Layout No
-
Ext. draw Yes
背景图片透明度(bg_img_opa)
设置背景图片的不透明度。0
, LV_OPA_0
或 LV_OPA_TRANSP
意味着完全透明, 256
, LV_OPA_100
或 LV_OPA_COVER
意味着不透明, 其他值或 LV_OPA_10
、LV_OPA_20
等表示半透明。
-
Default
LV_OPA_COVER
-
Inherited No
-
Layout No
-
Ext. draw No
背景图片重新着色(bg_img_recolor)
设置一种颜色以混合到背景图像。
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
背景图片重新着色强度(bg_img_recolor_opa)
设置背景图像重新着色的强度。 值 0、LV_OPA_0
或 LV_OPA_TRANSP
表示不混合,256、LV_OPA_100
或 LV_OPA_COVER
表示完全重新着色,其他值或 LV_OPA_10、LV_OPA_20 等按比例解释。
-
Default
LV_OPA_TRANSP
-
Inherited No
-
Layout No
-
Ext. draw No
背景图片平铺(bg_img_tiled)
如果启用,背景图像将被平铺。 可能的值为“true”或“false”。
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
边框(Border)
描述边狂的属性
边框颜色(border_color)
Set the color of the border
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
边框不透明度(border_opa)
设置边框的不透明度。 0
, LV_OPA_0
或 LV_OPA_TRANSP
意味着完全透明, 256
, LV_OPA_100
或 LV_OPA_COVER
意味着不透明, 其他值或 LV_OPA_10
、LV_OPA_20
等表示半透明。
-
Default
LV_OPA_COVER
-
Inherited No
-
Layout No
-
Ext. draw No
边框宽度(border_width)
设置边框的宽度。 只能使用像素值。
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
边界尺寸(border_side)
Set ony which side(s) the border should be drawn. The possible values are LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL
. OR-ed calues an be used as well, e.g. LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT
.
-
Default
LV_BORDER_SIDE_NONE
-
Inherited No
-
Layout No
-
Ext. draw No
border_post
Sets whether the the border should be drawn before or after the children ar drawn. true
: after children, false
: before children
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
轮廓(Outline)
描述轮廓的属性。它像边框,但绘制在矩形之外。
轮廓宽度(outline_width)
Set the width of the outline in pixels.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
outline_color
Set the color of the outline.
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
outline_opa
Set the opacity of the outline. Value 0, LV_OPA_0
or LV_OPA_TRANSP
means fully transparent, 256, LV_OPA_100
or LV_OPA_COVER
means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
-
Default
LV_OPA_COVER
-
Inherited No
-
Layout No
-
Ext. draw Yes
outline_pad
Set the padding of the outline, i.e. the gap between object and the outline.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
Shadow
Properties to describe the shadow drawn under the rectangles.
shadow_width
Set the width of the shadow in pixels. The value should be >= 0.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
shadow_ofs_x
Set an offset on the shadow in pixels in X direction.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
shadow_ofs_y
Set an offset on the shadow in pixels in Y direction.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
shadow_spread
Make the shadow calcuation to use a larger or smaller rectangle as base. The value can be in pixel to make the area larger/smaller
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
shadow_color
Set the color of the shadow
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
shadow_opa
Set the opacity of the shadow. Value 0, LV_OPA_0
or LV_OPA_TRANSP
means fully transparent, 256, LV_OPA_100
or LV_OPA_COVER
means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
-
Default
LV_OPA_COVER
-
Inherited No
-
Layout No
-
Ext. draw Yes
Image
Properties to describe the images
img_opa
Set the opacity of an image. Value 0, LV_OPA_0
or LV_OPA_TRANSP
means fully transparent, 256, LV_OPA_100
or LV_OPA_COVER
means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
-
Default
LV_OPA_COVER
-
Inherited No
-
Layout No
-
Ext. draw No
img_recolor
Set color to mixt to the image.
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
img_recolor_opa
Set the intensity of the color mixing. Value 0, LV_OPA_0
or LV_OPA_TRANSP
means fully transparent, 256, LV_OPA_100
or LV_OPA_COVER
means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
Line
Properties to describe line-like objects
line_width
Set the width of the lines in pixel.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
line_dash_width
Set the width of dashes in pixel. Note that dash works only on horizontal and vertical lines
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
line_dash_gap
Set the gap between dashes in pixel. Note that dash works only on horizontal and vertical lines
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
line_rounded
Make the end points of the lines rounded. true
: rounded, false
: perpendicular line ending
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
line_color
Set the color fo the lines.
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
line_opa
Set the opacity of the lines.
-
Default
LV_OPA_COVER
-
Inherited No
-
Layout No
-
Ext. draw No
Arc
TODO
arc_width
Set the width (ticjkness) of the arcs in pixel.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw Yes
arc_rounded
Make the end points of the arcs rounded. true
: rounded, false
: perpendicular line ending
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
arc_color
Set the color of the arc.
-
Default
0x000000
-
Inherited No
-
Layout No
-
Ext. draw No
arc_opa
Set the opacity of the arcs.
-
Default
LV_OPA_COVER
-
Inherited No
-
Layout No
-
Ext. draw No
arc_img_src
Set an image from which the arc will be masked out. It’s useful to display complex effects on the arcs. Can be a pointer to lv_img_dsc_t
or a path to a file
-
Default
NULL
-
Inherited No
-
Layout No
-
Ext. draw No
Text
Properties to describe the propeties of text. All these properties are inherited.
text_color
Sets the color of the text.
-
Default
0x000000
-
Inherited Yes
-
Layout No
-
Ext. draw No
text_opa
Set the opacity of the text. Value 0, LV_OPA_0
or LV_OPA_TRANSP
means fully transparent, 256, LV_OPA_100
or LV_OPA_COVER
means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
-
Default
LV_OPA_COVER
-
Inherited Yes
-
Layout No
-
Ext. draw No
text_font
Set the font of the text (a pointer lv_font_t *
).
-
Default
LV_FONT_DEFAULT
-
Inherited Yes
-
Layout Yes
-
Ext. draw No
text_letter_space
Set the letter space in pixels
-
Default 0
-
Inherited Yes
-
Layout Yes
-
Ext. draw No
text_line_space
Set the line space in pixels.
-
Default 0
-
Inherited Yes
-
Layout Yes
-
Ext. draw No
text_decor
Set decoration for the text. The possible values are LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH
. OR-ed values can be used as well.
-
Default
LV_TEXT_DECOR_NONE
-
Inherited Yes
-
Layout No
-
Ext. draw No
text_align
Set how to align the lines of the text. Note that it doesn’t align the object itself, only the lines inside the object. The possible values are LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO
. LV_TEXT_ALIGN_AUTO
detect the text base direction and uses left or right alignment accordingly
-
Default
LV_TEXT_ALIGN_AUTO
-
Inherited Yes
-
Layout Yes
-
Ext. draw No
Miscellaneous
Mixed proprites for various purposes.
radius
Set the radius on every corner. The value is interpreted in pixel (>= 0) or LV_RADIUS_CIRCLE
for max. radius
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
clip_corner
Enable to clip the overflowed content on the rounded corner. Can be true
or false
.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
opa
Scale down all opacity values of the object by this factor. Value 0, LV_OPA_0
or LV_OPA_TRANSP
means fully transparent, 256, LV_OPA_100
or LV_OPA_COVER
means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
-
Default
LV_OPA_COVER
-
Inherited Yes
-
Layout No
-
Ext. draw No
color_filter_dsc
Mix a color to all colors of the object.
-
Default
NULL
-
Inherited No
-
Layout No
-
Ext. draw No
color_filter_opa
The intensity of mixing of color filter.
-
Default
LV_OPA_TRANSP
-
Inherited No
-
Layout No
-
Ext. draw No
anim_time
The animation time in milliseconds. It’s meaning is widget specific. E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets’ documentation to learn more.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
anim_speed
The animation speed in pixel/sec. It’s meaning is widget specific. E.g. scroll speed of label. See the widgets’ documentation to learn more.
-
Default 0
-
Inherited No
-
Layout No
-
Ext. draw No
transition
An initialized lv_style_transition_dsc_t
to describe a transition.
-
Default
NULL
-
Inherited No
-
Layout No
-
Ext. draw No
blend_mode
Describes how to blend the colors to the background. The possibel values are LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY
-
Default
LV_BLEND_MODE_NORMAL
-
Inherited No
-
Layout No
-
Ext. draw No
layout
Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts.
-
Default 0
-
Inherited No
-
Layout Yes
-
Ext. draw No
base_dir
Set the base direction of the obejct. The possible values are LV_BIDI_DIR_LTR/RTL/AUTO
.
-
Default
LV_BASE_DIR_AUTO
-
Inherited Yes
-
Layout Yes
-
Ext. draw No
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具