当前位置:网站首页>LVGL 8.2 text shadow
LVGL 8.2 text shadow
2022-07-04 14:35:00 【Fairy sword love】
Create a fake text shadow
static void lv_example_label_2(void)
{
/*Create a style for the shadow*/
static lv_style_t style_shadow;
lv_style_init(&style_shadow);
lv_style_set_text_opa(&style_shadow, LV_OPA_30);
lv_style_set_text_color(&style_shadow, lv_color_black());
/*Create a label for the shadow first (it's in the background)*/
lv_obj_t* shadow_label = lv_label_create(lv_scr_act());
lv_obj_add_style(shadow_label, &style_shadow, 0);
/*Create the main label*/
lv_obj_t* main_label = lv_label_create(lv_scr_act());
lv_label_set_text(main_label, "A simple method to create\n"
"shadows on a text.\n"
"It even works with\n\n"
"newlines and spaces.");
/*Set the same text for the shadow label*/
lv_label_set_text(shadow_label, lv_label_get_text(main_label));
/*Position the main label*/
lv_obj_align(main_label, LV_ALIGN_CENTER, 0, 0);
/*Shift the second label down and to the right by 2 pixel*/
lv_obj_align_to(shadow_label, main_label, LV_ALIGN_TOP_LEFT, 2, 2);
}
Running effect
- Modify shadow transparency from LV_OPA_30 Change to LV_OPA_60
lv_style_set_text_opa(&style_shadow, LV_OPA_60);
- Running effect
- Modify shadow alignment coordinates
lv_obj_align_to(shadow_label, main_label, LV_ALIGN_TOP_LEFT, 4, 4);
- Running effect
边栏推荐
- [algorithm leetcode] interview question 04.03 Specific depth node linked list (Multilingual Implementation)
- 流行框架:Glide的使用
- 阿里被裁员工,找工作第N天,猎头又传来噩耗...
- Programmer turns direction
- 关于miui12.5 红米k20pro用au或者povo2出现问题的解决办法
- Detailed index of MySQL
- 10. (map data) offline terrain data processing (for cesium)
- scratch古堡历险记 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月
- Leetcode T47: 全排列II
- Visual Studio调试方式详解
猜你喜欢
LVGL 8.2 LED
[information retrieval] experiment of classification and clustering
Compile oglpg-9th-edition source code with clion
Detailed index of MySQL
Visual Studio调试方式详解
Real time data warehouse
失败率高达80%,企业数字化转型路上有哪些挑战?
Detailed explanation of visual studio debugging methods
RK1126平台OSD的实现支持颜色半透明度多通道支持中文
Explain of SQL optimization
随机推荐
Transplant tinyplay for imx6q development board QT system
Matters needing attention in overseas game Investment Agency
What is the difference between Bi financial analysis in a narrow sense and financial analysis in a broad sense?
Learn kernel 3: use GDB to track the kernel call chain
Redis daily notes
Leetcode T48: rotating images
实战解惑 | OpenCV中如何提取不规则ROI区域
Leetcode T47: 全排列II
ML:SHAP值的简介、原理、使用方法、经典案例之详细攻略
LifeCycle
nowcoder重排链表
Test process arrangement (2)
LVGL 8.2 List
数据中台概念
利用Shap值进行异常值检测
Docker compose public network deployment redis sentinel mode
Compile oglpg-9th-edition source code with clion
R language uses bwplot function in lattice package to visualize box plot and par Settings parameter custom theme mode
Talk about 10 tips to ensure thread safety
Programmer turns direction