LVGL Video控件和Radiobtn控件詳解

LVGL Video控件和Radiobtn控件詳解

  • 一、 Video控件詳解
    • 1. 概述
    • 2. 創建和初始化
    • 3. 基本屬性設置
    • 4. 視頻控制
    • 5. 回調函數
    • 6. 高級功能
    • 7. 注意事項
  • 二、Radiobtn控件詳解
    • 1. 概述
    • 2. 創建和初始化
    • 3. 屬性設置
    • 4. 狀態控制
    • 5. 組管理
    • 6. 事件處理
    • 7. 樣式設置
    • 8. 注意事項
  • 三、效果展示
  • 四、源碼分享

一、 Video控件詳解

1. 概述

  • 功能lv_video 是 LVGL 提供的一個用于播放視頻的控件。
  • 依賴:需要外部的視頻解碼庫(如 FFmpeg)來處理視頻文件。

2. 創建和初始化

  • 創建
    lv_obj_t * video = lv_video_create(lv_scr_act());
    
  • 初始化
    • 設置視頻源:
      lv_video_set_src(video, "path/to/video.mp4");
      

3. 基本屬性設置

  • 大小
    lv_obj_set_size(video, width, height);
    
  • 位置
    lv_obj_set_pos(video, x, y);
    

4. 視頻控制

  • 播放
    lv_video_start(video);
    
  • 暫停
    lv_video_pause(video);
    
  • 停止
    lv_video_stop(video);
    
  • 跳轉到指定時間
    lv_video_seek(video, time_in_ms);
    

5. 回調函數

  • 事件回調
    static void video_event_cb(lv_event_t * e) {lv_event_code_t code = lv_event_get_code(e);lv_obj_t * obj = lv_event_get_target(e);if (code == LV_EVENT_PLAYBACK_FINISHED) {// 視頻播放結束}
    }lv_obj_add_event_cb(video, video_event_cb, LV_EVENT_ALL, NULL);
    

6. 高級功能

  • 音量控制
    lv_video_set_volume(video, volume); // 0-100
    
  • 循環播放
    lv_video_set_loop(video, true); // 或 false
    

7. 注意事項

  • 性能:視頻播放可能對系統資源消耗較大,確保硬件支持。
  • 兼容性:確保使用的視頻格式與解碼庫兼容。

二、Radiobtn控件詳解

1. 概述

  • 功能lv_radio 控件用于在多個選項中選擇一個。
  • 特點:單選按鈕,一次只能選擇一個選項。

2. 創建和初始化

  • 創建

    lv_obj_t * radio = lv_radio_create(lv_scr_act());
    
  • 初始化

    • 設置文本:
      lv_radio_set_text(radio, "Option 1");
      

3. 屬性設置

  • 大小

    lv_obj_set_size(radio, width, height);
    
  • 位置

    lv_obj_set_pos(radio, x, y);
    
  • 對齊方式

    lv_obj_align(radio, LV_ALIGN_CENTER, 0, 0);
    

4. 狀態控制

  • 選中狀態

    • 選中:

      lv_radio_on(radio, LV_ANIM_ON);
      
    • 取消選中:

      lv_radio_off(radio, LV_ANIM_ON);
      
  • 檢查狀態

    bool is_checked = lv_radio_is_checked(radio);
    

5. 組管理

  • 創建組

    lv_group_t * group = lv_group_create();
    
  • 添加到組

    lv_group_add_obj(group, radio);
    
  • 切換選中項

    lv_group_focus_obj(radio);
    

6. 事件處理

  • 事件回調
    static void radio_event_cb(lv_event_t * e) {lv_event_code_t code = lv_event_get_code(e);lv_obj_t * obj = lv_event_get_target(e);if (code == LV_EVENT_VALUE_CHANGED) {if (lv_radio_is_checked(obj)) {// 處理選中事件}}
    }lv_obj_add_event_cb(radio, radio_event_cb, LV_EVENT_ALL, NULL);
    

7. 樣式設置

  • 默認樣式

    lv_obj_set_style_bg_color(radio, lv_color_hex(0x00FF00), 0);
    
  • 選中樣式

    lv_obj_set_style_bg_color(radio, lv_color_hex(0xFF0000), LV_STATE_CHECKED);
    

8. 注意事項

  • 互斥性:同一組內的單選按鈕是互斥的,即一次只能有一個被選中。
  • 布局:合理安排單選按鈕的位置和大小,確保用戶界面友好。

三、效果展示

在這里插入圖片描述

四、源碼分享

ui.h

typedef struct
{lv_obj_t *screen;bool screen_del;lv_obj_t *screen_radiobtn_1;lv_obj_t *screen_radiobtn_1_item0;lv_obj_t *screen_radiobtn_1_item1;lv_obj_t *screen_radiobtn_1_item2;lv_obj_t *screen_video_1;
}lv_ui;

ui.c

#include "lvgl.h"
#include <stdio.h>
#include "gui_guider.h"
#include "events_init.h"
#include "widgets_init.h"
#include "custom.h"void setup_scr_screen(lv_ui *ui)
{//Write codes screenui->screen = lv_obj_create(NULL);lv_obj_set_size(ui->screen, 800, 480);lv_obj_set_scrollbar_mode(ui->screen, LV_SCROLLBAR_MODE_OFF);//Write style for screen, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.lv_obj_set_style_bg_opa(ui->screen, 255, LV_PART_MAIN|LV_STATE_DEFAULT);lv_obj_set_style_bg_color(ui->screen, lv_color_hex(0x13e6d2), LV_PART_MAIN|LV_STATE_DEFAULT);lv_obj_set_style_bg_grad_dir(ui->screen, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);//Write codes screen_radiobtn_1ui->screen_radiobtn_1 = lv_radiobtn_create(ui->screen);ui->screen_radiobtn_1_item0 =lv_radiobtn_add_item(ui->screen_radiobtn_1, "radio1");ui->screen_radiobtn_1_item1 =lv_radiobtn_add_item(ui->screen_radiobtn_1, "radio2");ui->screen_radiobtn_1_item2 =lv_radiobtn_add_item(ui->screen_radiobtn_1, "radio3");lv_obj_set_pos(ui->screen_radiobtn_1, 96, 130);lv_obj_set_size(ui->screen_radiobtn_1, 201, 235);//Write style state: LV_STATE_DEFAULT for &style_screen_radiobtn_1_main_main_defaultstatic lv_style_t style_screen_radiobtn_1_main_main_default;ui_init_style(&style_screen_radiobtn_1_main_main_default);lv_style_set_pad_top(&style_screen_radiobtn_1_main_main_default, 5);lv_style_set_pad_left(&style_screen_radiobtn_1_main_main_default, 5);lv_style_set_pad_right(&style_screen_radiobtn_1_main_main_default, 5);lv_style_set_pad_bottom(&style_screen_radiobtn_1_main_main_default, 5);lv_style_set_border_width(&style_screen_radiobtn_1_main_main_default, 1);lv_style_set_border_opa(&style_screen_radiobtn_1_main_main_default, 0);lv_style_set_border_color(&style_screen_radiobtn_1_main_main_default, lv_color_hex(0xe1e6ee));lv_style_set_border_side(&style_screen_radiobtn_1_main_main_default, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_main_main_default, 6);lv_style_set_bg_opa(&style_screen_radiobtn_1_main_main_default, 255);lv_style_set_bg_color(&style_screen_radiobtn_1_main_main_default, lv_color_hex(0x2195f6));lv_style_set_bg_grad_dir(&style_screen_radiobtn_1_main_main_default, LV_GRAD_DIR_NONE);lv_style_set_shadow_width(&style_screen_radiobtn_1_main_main_default, 0);lv_obj_add_style(ui->screen_radiobtn_1, &style_screen_radiobtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);//Write style state: LV_STATE_DEFAULT for &style_screen_radiobtn_1_extra_btns_main_defaultstatic lv_style_t style_screen_radiobtn_1_extra_btns_main_default;ui_init_style(&style_screen_radiobtn_1_extra_btns_main_default);lv_style_set_pad_top(&style_screen_radiobtn_1_extra_btns_main_default, 3);lv_style_set_pad_right(&style_screen_radiobtn_1_extra_btns_main_default, 0);lv_style_set_pad_bottom(&style_screen_radiobtn_1_extra_btns_main_default, 0);lv_style_set_pad_left(&style_screen_radiobtn_1_extra_btns_main_default, 0);lv_style_set_text_color(&style_screen_radiobtn_1_extra_btns_main_default, lv_color_hex(0xffffff));lv_style_set_text_font(&style_screen_radiobtn_1_extra_btns_main_default, &lv_font_montserratMedium_16);lv_style_set_text_opa(&style_screen_radiobtn_1_extra_btns_main_default, 255);lv_style_set_text_letter_space(&style_screen_radiobtn_1_extra_btns_main_default, 2);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_main_default, 6);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_main_default, 0);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);//Write style state: LV_STATE_DEFAULT for &style_screen_radiobtn_1_extra_btns_indicator_defaultstatic lv_style_t style_screen_radiobtn_1_extra_btns_indicator_default;ui_init_style(&style_screen_radiobtn_1_extra_btns_indicator_default);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_indicator_default, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_indicator_default, 255);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_indicator_default, lv_color_hex(0x5cd624));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_indicator_default, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_indicator_default, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_indicator_default, 255);lv_style_set_bg_color(&style_screen_radiobtn_1_extra_btns_indicator_default, lv_color_hex(0xffffff));lv_style_set_bg_grad_dir(&style_screen_radiobtn_1_extra_btns_indicator_default, LV_GRAD_DIR_NONE);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_indicator_default, LV_PART_INDICATOR|LV_STATE_DEFAULT);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_indicator_default, LV_PART_INDICATOR|LV_STATE_DEFAULT);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_indicator_default, LV_PART_INDICATOR|LV_STATE_DEFAULT);//Write style state: LV_STATE_PRESSED for &style_screen_radiobtn_1_extra_btns_indicator_pressedstatic lv_style_t style_screen_radiobtn_1_extra_btns_indicator_pressed;ui_init_style(&style_screen_radiobtn_1_extra_btns_indicator_pressed);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_indicator_pressed, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_indicator_pressed, 255);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_indicator_pressed, lv_color_hex(0x5cd624));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_indicator_pressed, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_indicator_pressed, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_indicator_pressed, 255);lv_style_set_bg_color(&style_screen_radiobtn_1_extra_btns_indicator_pressed, lv_color_hex(0xffffff));lv_style_set_bg_grad_dir(&style_screen_radiobtn_1_extra_btns_indicator_pressed, LV_GRAD_DIR_NONE);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_indicator_pressed, LV_PART_INDICATOR|LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_indicator_pressed, LV_PART_INDICATOR|LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_indicator_pressed, LV_PART_INDICATOR|LV_STATE_PRESSED);//Write style state: LV_STATE_CHECKED for &style_screen_radiobtn_1_extra_btns_indicator_checkedstatic lv_style_t style_screen_radiobtn_1_extra_btns_indicator_checked;ui_init_style(&style_screen_radiobtn_1_extra_btns_indicator_checked);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_indicator_checked, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_indicator_checked, 255);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_indicator_checked, lv_color_hex(0x5cd624));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_indicator_checked, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_indicator_checked, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_indicator_checked, 255);lv_style_set_bg_color(&style_screen_radiobtn_1_extra_btns_indicator_checked, lv_color_hex(0xffffff));lv_style_set_bg_grad_dir(&style_screen_radiobtn_1_extra_btns_indicator_checked, LV_GRAD_DIR_NONE);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED);//Write style state: LV_STATE_CHECKED | LV_STATE_PRESSED for &style_screen_radiobtn_1_extra_btns_indicator_checked_pressedstatic lv_style_t style_screen_radiobtn_1_extra_btns_indicator_checked_pressed;ui_init_style(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, 255);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, lv_color_hex(0x5cd624));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, 255);lv_style_set_bg_color(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, lv_color_hex(0xffffff));lv_style_set_bg_grad_dir(&style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, LV_GRAD_DIR_NONE);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, LV_PART_INDICATOR|LV_STATE_CHECKED | LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, LV_PART_INDICATOR|LV_STATE_CHECKED | LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_indicator_checked_pressed, LV_PART_INDICATOR|LV_STATE_CHECKED | LV_STATE_PRESSED);//Write style state: LV_STATE_DEFAULT for &style_screen_radiobtn_1_extra_btns_custom_defaultstatic lv_style_t style_screen_radiobtn_1_extra_btns_custom_default;ui_init_style(&style_screen_radiobtn_1_extra_btns_custom_default);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_custom_default, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_custom_default, 0);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_custom_default, lv_color_hex(0xffffff));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_custom_default, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_custom_default, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_custom_default, 0);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_custom_default, LV_PART_CUSTOM_FIRST|LV_STATE_DEFAULT);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_custom_default, LV_PART_CUSTOM_FIRST|LV_STATE_DEFAULT);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_custom_default, LV_PART_CUSTOM_FIRST|LV_STATE_DEFAULT);//Write style state: LV_STATE_PRESSED for &style_screen_radiobtn_1_extra_btns_custom_pressedstatic lv_style_t style_screen_radiobtn_1_extra_btns_custom_pressed;ui_init_style(&style_screen_radiobtn_1_extra_btns_custom_pressed);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_custom_pressed, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_custom_pressed, 0);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_custom_pressed, lv_color_hex(0xffffff));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_custom_pressed, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_custom_pressed, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_custom_pressed, 0);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_custom_pressed, LV_PART_CUSTOM_FIRST|LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_custom_pressed, LV_PART_CUSTOM_FIRST|LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_custom_pressed, LV_PART_CUSTOM_FIRST|LV_STATE_PRESSED);//Write style state: LV_STATE_CHECKED for &style_screen_radiobtn_1_extra_btns_custom_checkedstatic lv_style_t style_screen_radiobtn_1_extra_btns_custom_checked;ui_init_style(&style_screen_radiobtn_1_extra_btns_custom_checked);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_custom_checked, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_custom_checked, 255);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_custom_checked, lv_color_hex(0x5cd624));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_custom_checked, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_custom_checked, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_custom_checked, 255);lv_style_set_bg_color(&style_screen_radiobtn_1_extra_btns_custom_checked, lv_color_hex(0x5cd624));lv_style_set_bg_grad_dir(&style_screen_radiobtn_1_extra_btns_custom_checked, LV_GRAD_DIR_NONE);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_custom_checked, LV_PART_CUSTOM_FIRST|LV_STATE_CHECKED);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_custom_checked, LV_PART_CUSTOM_FIRST|LV_STATE_CHECKED);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_custom_checked, LV_PART_CUSTOM_FIRST|LV_STATE_CHECKED);//Write style state: LV_STATE_CHECKED | LV_STATE_PRESSED for &style_screen_radiobtn_1_extra_btns_custom_checked_pressedstatic lv_style_t style_screen_radiobtn_1_extra_btns_custom_checked_pressed;ui_init_style(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed);lv_style_set_border_width(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, 2);lv_style_set_border_opa(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, 255);lv_style_set_border_color(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, lv_color_hex(0x5cd624));lv_style_set_border_side(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, LV_BORDER_SIDE_FULL);lv_style_set_radius(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, 20);lv_style_set_bg_opa(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, 255);lv_style_set_bg_color(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, lv_color_hex(0x5cd624));lv_style_set_bg_grad_dir(&style_screen_radiobtn_1_extra_btns_custom_checked_pressed, LV_GRAD_DIR_NONE);lv_obj_add_style(ui->screen_radiobtn_1_item2, &style_screen_radiobtn_1_extra_btns_custom_checked_pressed, LV_PART_CUSTOM_FIRST|LV_STATE_CHECKED | LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item1, &style_screen_radiobtn_1_extra_btns_custom_checked_pressed, LV_PART_CUSTOM_FIRST|LV_STATE_CHECKED | LV_STATE_PRESSED);lv_obj_add_style(ui->screen_radiobtn_1_item0, &style_screen_radiobtn_1_extra_btns_custom_checked_pressed, LV_PART_CUSTOM_FIRST|LV_STATE_CHECKED | LV_STATE_PRESSED);//Write codes screen_video_1ui->screen_video_1 = lv_video_create(ui->screen, 322, 236);
#if LV_USE_GUIDER_SIMULATORlv_video_set_src(ui->screen_video_1,"C:\\NXP\\GUI-Guider-Projects\\ergdfgds\\import\\video\\1080P30.h264");
#elselv_video_set_src(ui->screen_video_1,"S:/1080P30.h264");
#endiflv_obj_set_pos(ui->screen_video_1, 389, 117);lv_obj_set_size(ui->screen_video_1, 322, 236);//The custom code of screen.//Update current screen layout.lv_obj_update_layout(ui->screen);}

在這里插入圖片描述

覺得有用點個贊唄!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/75931.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/75931.shtml
英文地址,請注明出處:http://en.pswp.cn/web/75931.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

AbortController:讓異步操作隨時說停就停

AbortController&#xff1a;讓異步操作隨時說停就停 一、什么是 AbortController&#xff1f; AbortController 是 JavaScript 在瀏覽器和部分 Node.js 環境中提供的全局類&#xff0c;用來中止正在進行或待完成的異步操作&#xff08;如 fetch() 請求、事件監聽、可寫流、數…

機器學習 從入門到精通 day_04

1. 決策樹-分類 1.1 概念 1. 決策節點 通過條件判斷而進行分支選擇的節點。如&#xff1a;將某個樣本中的屬性值(特征值)與決策節點上的值進行比較&#xff0c;從而判斷它的流向。 2. 葉子節點 沒有子節點的節點&#xff0c;表示最終的決策結果。 3. 決策樹的…

C++ Primer (第五版)-第十三章 拷貝控制

文章目錄 概述13.1拷貝、賦值與銷毀合成拷貝構造函數拷貝初始化參數和返回值拷貝初始化的限制編譯器可以繞過拷貝構造函數拷貝運算符析構函數三/五原則使用default阻止拷貝合成的拷貝控制成員可能是刪除的 private拷貝控制拷貝控制和資源管理行為像值的類類值拷貝賦值運算符定義…

Vue el-from的el-form-item v-for循環表單如何校驗rules(一)

實際業務需求場景&#xff1a; 新增或編輯頁面&#xff08;基礎信息表單&#xff0c;一個數據列表的表單&#xff09;&#xff0c;數據列表里面的表單數是動態添加的。數據可新增、可刪除&#xff0c;在表單保存前&#xff0c;常常需要做表單必填項的校驗&#xff0c;校驗通過以…

測試100問:http和https的區別是什么?

哈嘍&#xff0c;大家好&#xff0c;我是十二&#xff0c;今天給大家分享的問題是&#xff1a;http和https的區別是什么&#xff1f; 首先我們要知道 HTTP 協議傳播的數據都是未加密的&#xff0c;也就是明文的&#xff0c;因此呢使用 http協議傳輸一些隱私信息也就非常不安全&…

YOLOv3超詳細解讀(三):源碼解析:數據處理模塊

一、概述 YOLOv3&#xff08;You Only Look Once v3&#xff09;是一種高效的目標檢測算法&#xff0c;其數據處理模塊是訓練和推理流程的核心部分。本文將深入分析Ultralytics團隊基于PyTorch實現的YOLOv3源碼中的數據處理模塊&#xff0c;重點探討數據加載、預處理和數據增強…

每日算法(雙指針算法)(Day 1)

雙指針算法 1.算法題目&#xff08;移動零&#xff09;2.講解算法原理3.編寫代碼 1.算法題目&#xff08;移動零&#xff09; 2.講解算法原理 數組劃分&#xff0c;數組分塊&#xff08;快排里面最核心的一步&#xff09;只需把0改為tmp 雙指針算法&#xff1a;利用數組下標來…

2025藍橋杯python A組省賽 題解

真捐款去了&#xff0c;好長時間沒練了&#xff0c;感覺腦子和手都不轉悠了。 B F BF BF 賽時都寫假了&#xff0c; G G G 也只寫了爆搜。 題解其實隊友都寫好了&#xff0c;我就粘一下自己的代碼&#xff0c;稍微提點個人的理解水一篇題解 隊友題解 2025藍橋杯C A組省賽 題…

測試基礎筆記第四天(html)

提示&#xff1a;文章寫完后&#xff0c;目錄可以自動生成&#xff0c;如何生成可參考右邊的幫助文檔 文章目錄 html介紹1. 介紹2.骨架標簽3.常用標簽標題標簽段落標簽超鏈接標簽圖片標簽換行和空格標簽布局標簽input標簽&#xff08;變形金剛&#xff09;form標簽列表標簽 htm…

10 穴 汽車連接器的15個設計特點

汽車行業嚴重依賴卓越的電氣系統來確保功能和可靠性。這些系統的關鍵組件是 10 腔連接器&#xff0c;它為布線和信號傳輸提供解決方案。制造商和工程師必須仔細評估這些連接器的設計特性&#xff0c;以優化性能和安全性。 本博客研究了汽車 10 腔連接器的 15 個設計特征&#…

Summary

一、數據結構 1.1 哈希 主要是HashMap和HashSet&#xff1b;其中HashSet底層是一個HashMap屬性。 // 獲取HashMap元素,HashSet均不支持 map.keySet (); // Set<k> map.values (; // Collection<V> map.entrySet();//Set<Map.Entry<K,V>> for (Map.E…

【Leetcode-Hot100】最小覆蓋子串

題目 解答 想到使用雙指針哈希表來實現&#xff0c;雙指針的left和right控制實現可滿足字符串。 class Solution(object):def minWindow(self, s, t):""":type s: str:type t: str:rtype: str"""len_s, len_t len(s), len(t)hash_map {}for…

Flutter 播放利器:`media_kit` 的詳細介紹與使用指南

在 Flutter 項目中實現音視頻播放&#xff0c;開發者過去主要依賴如 video_player、just_audio 等第三方庫&#xff0c;但這些庫或多或少存在一些局限性&#xff0c;比如平臺兼容性差、定制能力不足、播放格式有限等問題。 而 media_kit 是近年崛起的一款全平臺音視頻播放解決…

4.14【Q】pc homework3

我正在學習并行計算&#xff0c;解決這個問題&#xff1f;詳細解釋&#xff0c;越細節越好 我正在學習并行計算&#xff0c;“首次允許在 taskloop 構造中使用 reduction 子句&#xff0c;并引入了 task_reduction&#xff08;用于 taskgroup 構造&#xff09;和 in_reduction&…

ArrayList vs LinkedList,HashMap vs TreeMap:如何選擇最適合的集合類?

精心整理了最新的面試資料和簡歷模板&#xff0c;有需要的可以自行獲取 點擊前往百度網盤獲取 點擊前往夸克網盤獲取 在 Java 開發中&#xff0c;集合類的選擇直接影響程序的性能和代碼的可維護性。不同的數據結構適用于不同的場景&#xff0c;盲目使用可能導致內存浪費、性能…

大模型訓練顯存壓縮實戰:ZeRO-3 vs 梯度累積 vs 量化混合策略

一、顯存瓶頸的本質與挑戰 大模型訓練面臨的核心矛盾是模型參數量指數級增長與GPU顯存容量線性提升之間的鴻溝。以175B參數模型為例&#xff0c;其顯存消耗主要來自三個方面&#xff1a; 參數存儲?&#xff1a;FP32精度下需700GB顯存?梯度緩存?&#xff1a;反向傳播產生的…

邊緣計算與隱私計算的融合:構建數據經濟的“隱形護盾“

在數據成為核心生產要素的今天&#xff0c;邊緣計算與隱私計算的交匯正在重塑技術生態。這并非簡單的技術疊加&#xff0c;而是一場關于數據主權、算力分配與信任機制的深度博弈。本文將從"數據流動的拓撲學"視角&#xff0c;探討二者融合如何重構數字社會的基礎設施…

Obsidian 文件夾體系構建 -INKA

Obsidian 文件夾體系構建 -INKA 本篇文章主要分享一下自己折騰學習實踐過的 INKA 框架方法。原地址&#xff1a;Obsidian文件夾體系構建–INKA。 文章目錄 Obsidian 文件夾體系構建 -INKA前言INKA簡介INKA 理論最佳實踐實際應用 反思 前言 上文 Obsidian文件夾體系構建-ACCES…

ocr-不動產權識別

目錄 一、在阿里云申請ocr識別服務 二、創建springboot項目 三、后續 一、在阿里云申請ocr識別服務 在線體驗&#xff1a;房產證圖片上傳 [阿里官方]不動產權證OCR文字識別_API專區_云市場-阿里云 (aliyun.com) 可以選擇一毛500次這個 當然也可以白嫖100 下面有個在線調試…

LeetCode算法題(Go語言實現)_47

題目 給你一個 m x n 的迷宮矩陣 maze &#xff08;下標從 0 開始&#xff09;&#xff0c;矩陣中有空格子&#xff08;用 ‘.’ 表示&#xff09;和墻&#xff08;用 ‘’ 表示&#xff09;。同時給你迷宮的入口 entrance &#xff0c;用 entrance [entrancerow, entrancecol…