LVGL V8之Add styles to parts and state
to and add State V8 LVGL styles
2023-09-14 09:06:41 时间
创建style
- 初时style
static lv_style_t style_indic;
lv_style_init(&style_indic);
- 设置背景色为淡红色
lv_style_set_bg_color(&style_indic, lv_palette_lighten(LV_PALETTE_RED, 3));
- 设置渐变颜色为红色
lv_style_set_bg_grad_color(&style_indic, lv_palette_main(LV_PALETTE_RED));
- 设置渐变颜色方向为水平方向渐变
lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_HOR);
- 初时化按键按下的style
static lv_style_t style_indic_pr;
lv_style_init(&style_indic_pr);
- 设置阴影颜色
lv_style_set_shadow_color(&style_indic_pr, lv_palette_main(LV_PALETTE_RED));
- 设置阴影宽度
lv_style_set_shadow_width(&style_indic_pr, 10);
- 设置阴影伸展部分
lv_style_set_shadow_spread(&style_indic_pr, 3);
- 创建slider对象,添加style,居中显示
lv_obj_t* obj = lv_slider_create(lv_scr_act());
lv_obj_add_style(obj, &style_indic, LV_PART_INDICATOR);
lv_obj_add_style(obj, &style_indic_pr, LV_PART_INDICATOR | LV_STATE_PRESSED);
lv_slider_set_value(obj, 70, LV_ANIM_OFF);
lv_obj_center(obj);
完整代码,仅供参考
static void lv_example_style_13(void)
{
static lv_style_t style_indic;
lv_style_init(&style_indic);
lv_style_set_bg_color(&style_indic, lv_palette_lighten(LV_PALETTE_RED, 3));
lv_style_set_bg_grad_color(&style_indic, lv_palette_main(LV_PALETTE_RED));
lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_HOR);
static lv_style_t style_indic_pr;
lv_style_init(&style_indic_pr);
lv_style_set_shadow_color(&style_indic_pr, lv_palette_main(LV_PALETTE_RED));
lv_style_set_shadow_width(&style_indic_pr, 10);
lv_style_set_shadow_spread(&style_indic_pr, 3);
/*Create an object with the new style_pr*/
lv_obj_t* obj = lv_slider_create(lv_scr_act());
lv_obj_add_style(obj, &style_indic, LV_PART_INDICATOR);
lv_obj_add_style(obj, &style_indic_pr, LV_PART_INDICATOR | LV_STATE_PRESSED);
lv_slider_set_value(obj, 70, LV_ANIM_OFF);
lv_obj_center(obj);
}
调用lv_example_style_13运行效果
- 修改阴影伸展部分
lv_style_set_shadow_spread(&style_indic_pr, 13);
- 效果图
相关文章
- ORA-01171: datafile string going offline due to error advancing checkpoint ORACLE 报错 故障修复 远程处理
- ORA-29659: SQLJ Object Type validation failed to get default connection ORACLE 报错 故障修复 远程处理
- ORA-27032: failed to obtain file size limit ORACLE 报错 故障修复 远程处理
- ORA-39339: Table string was skipped due to transportable import and TSTZ issues resulting from time zone version mismatch. ORACLE 报错 故障修复 远程处理
- MySQL Error number: MY-011383; Symbol: ER_KEYRING_OKV_FAILED_TO_FIND_STANDBY_SERVER_ENTRY; SQLSTATE: HY000 报错 故障修复 远程处理
- MySQL Error number: MY-011431; Symbol: ER_KEYRING_AWS_FAILED_TO_GENERATE_KEY_DUE_TO_INTERNAL_ERROR; SQLSTATE: HY000 报错 故障修复 远程处理
- ORA-09352: Windows 32-bit Two-Task driver unable to spawn new ORACLE task ORACLE 报错 故障修复 远程处理
- ORA-12413: labels do not belong to the same policy ORACLE 报错 故障修复 远程处理
- hbase错误:Org.apache.hadoop.ipc.RemoteException:User:client is not allowed to impersonate root详解大数据
- Exploring the Benefits of Oracle Share: A Guide to Collaboration and File Sharing.(oracleshare)
- Troubleshooting Error 1135 in MySQL: How to Solve It and Get Your Database Back on Track(mysql1135)
- Maximizing Database Efficiency: A Guide to Oracle Table Compression(oracle收缩表)
- Mastering MySQL: The Ultimate Guide to Table Definition and Design(mysql表定义)
- Building a robust application with SSM and MongoDB: A guide to seamless integration.(ssmmongodb)
- How to Easily Establish an Oracle Database Connection with These Simple Connection Statements(oracle连接语句)
- Efficient Grouping and Summing in Linux: A Guide to Streamlining Your Operations(linux分组求和)
- Ultimate Guide to Setting Up and Configuring Linux Named DNS Server!(linuxnamed)
- Oracle数据库中的AND查询(oracle and查询)
- 深入探究Mysql中IN与AND逻辑运算的应用(mysql中in与and)
- 服务器部署,实现高可用性Note As an AI language model I can only provide a heading according to the keywords given to me It may or may not make sense Kindly proofread the language tone and content once generated by AI
- 利用Oracle TO函数实现数据转换(oracle to_函数)