frameworks 之 Activity添加View
frameworks 之 Activity添加View
- 1 LaunchActivityItem
- 1.1 Activity 创建
- 1.2 PhoneWindow 创建
- 1.3 DecorView 创建
- 2 ResumeActivityItem
讲解 Activity加载View的时机和流程
涉及到的类如下
- frameworks/base/core/java/android/app/Activity.java
- frameworks/base/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java
- frameworks/base/core/java/com/android/internal/policy/PhoneWindow.java
- frameworks/base/core/java/android/view/WindowManagerImpl.java
从之前文章Activity启动流程可知,最终会到 ActivityTaskSupervisor 的 realStartActivityLocked 方法,而 realStartActivityLocked 最终会执行 2个主要步骤 就是 LaunchActivityItem 和 ResumeActivityItem。
1 LaunchActivityItem
1.1 Activity 创建
LaunchActivityItem 的 又会调用 ActivityThread的 handleLaunchActivity 方法
public void execute(ClientTransactionHandler client, IBinder token,PendingTransactionActions pendingActions) {Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "activityStart");ActivityClientRecord r = client.getLaunchingActivity(token);client.handleLaunchActivity(r, pendingActions, null /* customIntent */);Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);}
handleLaunchActivity 又会调用 performLaunchActivity 方法
public Activity handleLaunchActivity(ActivityClientRecord r,PendingTransactionActions pendingActions, Intent customIntent) {...final Activity a = performLaunchActivity(r, customIntent);...return a;}
performLaunchActivity 方法中
- 会通过反射调用对应的 Activity
- 调用 Activity的 attach 方法创建phoneWindow
- 通过 callActivityOnCreate 执行 Activity的 onCreate方法
- 设置 ActivityClientRecord 状态为 ON_CREATE
private Activity performLaunchActivity(ActivityClientRecord r, Intent customIntent) {...ContextImpl appContext = createBaseContextForActivity(r);// 进行反射创建对应的 Activity对象Activity activity = null;try {java.lang.ClassLoader cl = appContext.getClassLoader();activity = mInstrumentation.newActivity(cl, component.getClassName(), r.intent);StrictMode.incrementExpectedActivityCount(activity.getClass());r.intent.setExtrasClassLoader(cl);r.intent.prepareToEnterProcess(isProtectedComponent(r.activityInfo),appContext.getAttributionSource());if (r.state != null) {r.state.setClassLoader(cl);}} catch (Exception e) {if (!mInstrumentation.onException(activity, e)) {throw new RuntimeException("Unable to instantiate activity " + component+ ": " + e.toString(), e);}}try {Application app = r.packageInfo.makeApplication(false, mInstrumentation);if (activity != null) {...// 调用 attach方法创建对应的的phoneView和 windowMangerImplactivity.attach(appContext, this, getInstrumentation(), r.token,r.ident, app, r.intent, r.activityInfo, title, r.parent,r.embeddedID, r.lastNonConfigurationInstances, config,r.referrer, r.voiceInteractor, window, r.configCallback,r.assistToken, r.shareableActivityToken);...r.activity = activity;// 触发Activity的 onCreate方法if (r.isPersistable()) {mInstrumentation.callActivityOnCreate(activity, r.state, r.persistentState);} else {mInstrumentation.callActivityOnCreate(activity, r.state);}...}// 设置 ActivityRecord状态为 ON_CREATEr.setState(ON_CREATE);} catch (SuperNotCalledException e) {throw e;} catch (Exception e) {if (!mInstrumentation.onException(activity, e)) {throw new RuntimeException("Unable to start activity " + component+ ": " + e.toString(), e);}}return activity;}
1.2 PhoneWindow 创建
查看上面 Attach 方法
- 创建了 PhoneWindow
- 调用 phoneWindow的setWindowManager 方法 创建对应 WindowManagerImpl 对象。
- 将创建的WindowManagerImpl 赋值给 mWindowManager
final void attach(Context context, ActivityThread aThread...) {...// 初始化 PhoneWindowmWindow = new PhoneWindow(this, window, activityConfigCallback);...// 初始化 并设置WindowManager到phoneWindow对应的变量mWindow.setWindowManager((WindowManager)context.getSystemService(Context.WINDOW_SERVICE),mToken, mComponent.flattenToString(),(info.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0);if (mParent != null) {mWindow.setContainer(mParent.getWindow());}// 将上一步通过 setWindowManager 创建WindowManagerImpl并赋值给 mWindowManagermWindowManager = mWindow.getWindowManager();
}
1.3 DecorView 创建
执行了 Activity onCreate 方法后 ,我们就会对其调用 setContentView 将要显示的布局ID创建创建视图,setContentView 方法又会调用 phoneWindow的setContentView方法
public void setContentView(@LayoutRes int layoutResID) {getWindow().setContentView(layoutResID);initWindowDecorActionBar();}
phoneWindow的setContentView主要做了
- 判断 mContentParent 是否为空(放应用要显示的布局容器),为空的话 则调用 installDecor 方法,创建 DecorView 和 内容容器 mContentParent
- 调用 inflate 将布局加载到 mContentParent 布局容器中
public void setContentView(int layoutResID) {// 如果contentview为空则加载decorViewif (mContentParent == null) {installDecor();} else if (!hasFeature(FEATURE_CONTENT_TRANSITIONS)) {mContentParent.removeAllViews();}if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) {final Scene newScene = Scene.getSceneForLayout(mContentParent, layoutResID,getContext());transitionTo(newScene);} else {// 将对应的布局加载到对应的内容区域mLayoutInflater.inflate(layoutResID, mContentParent);}...}
其中 installDecor 方法主要逻辑
- 判断 mDecor 是否为空 ,为空的话调用 generateDecor 方法**(直接new DecorView),,并赋值**
- 判断 mContentParent 是否为空,为空的话 调用 generateLayout() 方法获取对应的容器.(里面会通过feature 加载对应的布局,然后获取R.id.content的控件),并返回。
- 根据属性 设置对应的标题。
private void installDecor() {mForceDecorInstall = false;// 为空则创建 DecorViewif (mDecor == null) {mDecor = generateDecor(-1);mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);mDecor.setIsRootNamespace(true);if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);}} else {mDecor.setWindow(this);}// 为空则获取 decorView 用布局加载好里面的id为content的viewgroupif (mContentParent == null) {mContentParent = generateLayout(mDecor);...mTitleView = findViewById(R.id.title);if (mTitleView != null) {if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {final View titleContainer = findViewById(R.id.title_container);if (titleContainer != null) {titleContainer.setVisibility(View.GONE);} else {mTitleView.setVisibility(View.GONE);}mContentParent.setForeground(null);} else {mTitleView.setText(mTitle);}}}}}
generateLayout 主要
- 获取一系列属性
- 调用 getLocalFeatures 生成对应的 features,根据获取到的属性获取对应的布局ID赋值到 layoutResource
- 调用 decorView 的 onResourcesLoaded 方法 inflage出对应的布局,并通过 addView添加到 decorView,赋值给对应的mContentRoot 属性。
- 根据mDecorView获取ID为 R.id.content的内容容器,并返回出去
protected ViewGroup generateLayout(DecorView decor) {...// 获取设置一系列属性mIsFloating = a.getBoolean(R.styleable.Window_windowIsFloating, false);int flagsToUpdate = (FLAG_LAYOUT_IN_SCREEN|FLAG_LAYOUT_INSET_DECOR)& (~getForcedWindowFlags());...// Inflate the window decor.// 获取对应的 layout布局文件int layoutResource;int features = getLocalFeatures();// System.out.println("Features: 0x" + Integer.toHexString(features));if ((features & ((1 << FEATURE_LEFT_ICON) | (1 << FEATURE_RIGHT_ICON))) != 0) {if (mIsFloating) {TypedValue res = new TypedValue();getContext().getTheme().resolveAttribute(R.attr.dialogTitleIconsDecorLayout, res, true);layoutResource = res.resourceId;} else {layoutResource = R.layout.screen_title_icons;}// XXX Remove this once action bar supports these features.removeFeature(FEATURE_ACTION_BAR);// System.out.println("Title Icons!");} else if ((features & ((1 << FEATURE_PROGRESS) | (1 << FEATURE_INDETERMINATE_PROGRESS))) != 0&& (features & (1 << FEATURE_ACTION_BAR)) == 0) {// Special case for a window with only a progress bar (and title).// XXX Need to have a no-title version of embedded windows.layoutResource = R.layout.screen_progress;// System.out.println("Progress!");} else if ((features & (1 << FEATURE_CUSTOM_TITLE)) != 0) {// Special case for a window with a custom title.// If the window is floating, we need a dialog layoutif (mIsFloating) {TypedValue res = new TypedValue();getContext().getTheme().resolveAttribute(R.attr.dialogCustomTitleDecorLayout, res, true);layoutResource = res.resourceId;} else {layoutResource = R.layout.screen_custom_title;}// XXX Remove this once action bar supports these features.removeFeature(FEATURE_ACTION_BAR);} else if ((features & (1 << FEATURE_NO_TITLE)) == 0) {// If no other features and not embedded, only need a title.// If the window is floating, we need a dialog layoutif (mIsFloating) {TypedValue res = new TypedValue();getContext().getTheme().resolveAttribute(R.attr.dialogTitleDecorLayout, res, true);layoutResource = res.resourceId;} else if ((features & (1 << FEATURE_ACTION_BAR)) != 0) {layoutResource = a.getResourceId(R.styleable.Window_windowActionBarFullscreenDecorLayout,R.layout.screen_action_bar);} else {layoutResource = R.layout.screen_title;}// System.out.println("Title!");} else if ((features & (1 << FEATURE_ACTION_MODE_OVERLAY)) != 0) {layoutResource = R.layout.screen_simple_overlay_action_mode;} else {// Embedded, so no decoration is needed.layoutResource = R.layout.screen_simple;// System.out.println("Simple!");}mDecor.onResourcesLoaded(mLayoutInflater, layoutResource);// 根据mDecorView获取ID为 R.id.contentViewGroup contentParent = (ViewGroup)findViewById(ID_ANDROID_CONTENT);if (contentParent == null) {throw new RuntimeException("Window couldn't find content container view");}...return contentParent;}
2 ResumeActivityItem
经过 onCreate 视图view都创建准备好后,就会进入 resume阶段
ResumeActivityItem 又会执行对应的 handleResumeActivity 方法。
public void execute(ClientTransactionHandler client, ActivityClientRecord r,PendingTransactionActions pendingActions) {Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "activityResume");// 执行 ActivityThread 的 handleResumeActivityclient.handleResumeActivity(r, true /* finalStateRequest */, mIsForward,"RESUME_ACTIVITY");Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);}
handleResumeActivity 方法
- 从 ActivityClientRecord 取出 创建的 Activity,。将 decorView 设置为 INVISIBLE,
- 将对应的 LayoutParams type 层级设置为 WindowManager.LayoutParams.TYPE_BASE_APPLICATION
- 调用 phoneWindow 创建的 WindowManagerImpl(attach创建) ,调用 addView 将 decorView添加到 WMS中。
public void handleResumeActivity(ActivityClientRecord r, boolean finalStateRequest,boolean isForward, String reason) {...final Activity a = r.activity;...final int forwardBit = isForward? WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION : 0;// If the window hasn't yet been added to the window manager,// and this guy didn't finish itself or start another activity,// then go ahead and add the window.boolean willBeVisible = !a.mStartedActivity;if (!willBeVisible) {willBeVisible = ActivityClient.getInstance().willActivityBeVisible(a.getActivityToken());}if (r.window == null && !a.mFinished && willBeVisible) {// 赋值 phoneWindow 给ActivityClientRecordr.window = r.activity.getWindow();View decor = r.window.getDecorView();decor.setVisibility(View.INVISIBLE);ViewManager wm = a.getWindowManager();WindowManager.LayoutParams l = r.window.getAttributes();// 将 decor赋值给activitya.mDecor = decor;// 设置Activity的层级为applicationl.type = WindowManager.LayoutParams.TYPE_BASE_APPLICATION;l.softInputMode |= forwardBit;...// 将decorView 通过 wms添加到容器中if (a.mVisibleFromClient) {if (!a.mWindowAdded) {a.mWindowAdded = true;wm.addView(decor, l);} }}}
WindowManagerImpl 添加时候 又会调用 全局单例WindowManagerGlobal 添加
public void addView(@NonNull View view, @NonNull ViewGroup.LayoutParams params) {applyTokens(params);mGlobal.addView(view, params, mContext.getDisplayNoVerify(), mParentWindow,mContext.getUserId());}
addView中 会调用
- 创建对应的 ViewRootImpl
- 将对应参数添加到各自的数组中
- 调用 ViewRootImpl 的 setVIew 开始执行添加视图的 3步曲 (addToDisplayAsUser, relayout, finishDraw)
public void addView(View view, ViewGroup.LayoutParams params,Display display, Window parentWindow, int userId) {if (view == null) {throw new IllegalArgumentException("view must not be null");}if (display == null) {throw new IllegalArgumentException("display must not be null");}if (!(params instanceof WindowManager.LayoutParams)) {throw new IllegalArgumentException("Params must be WindowManager.LayoutParams");}final WindowManager.LayoutParams wparams = (WindowManager.LayoutParams) params;// 如果不为空则认为子窗口添加,通过 adjustLayoutParamsForSubWindow 补全对应的参数 如title 和 tokenif (parentWindow != null) {parentWindow.adjustLayoutParamsForSubWindow(wparams);} else {// If there's no parent, then hardware acceleration for this view is// set from the application's hardware acceleration setting.final Context context = view.getContext();if (context != null&& (context.getApplicationInfo().flags& ApplicationInfo.FLAG_HARDWARE_ACCELERATED) != 0) {wparams.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;}}// 创建对应的 ViewRootImplViewRootImpl root;View panelParentView = null;synchronized (mLock) {// Start watching for system property changes.if (mSystemPropertyUpdater == null) {mSystemPropertyUpdater = new Runnable() {@Override public void run() {synchronized (mLock) {for (int i = mRoots.size() - 1; i >= 0; --i) {mRoots.get(i).loadSystemProperties();}}}};SystemProperties.addChangeCallback(mSystemPropertyUpdater);}// 从 mViews 获取该view是否已添加int index = findViewLocked(view, false);if (index >= 0) {// 判断该view是否在移除if (mDyingViews.contains(view)) {// Don't wait for MSG_DIE to make it's way through root's queue.mRoots.get(index).doDie();} else {throw new IllegalStateException("View " + view+ " has already been added to the window manager.");}// The previous removeView() had not completed executing. Now it has.}// If this is a panel window, then find the window it is being// attached to for future reference.if (wparams.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW &&wparams.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {final int count = mViews.size();for (int i = 0; i < count; i++) {if (mRoots.get(i).mWindow.asBinder() == wparams.token) {panelParentView = mViews.get(i);}}}// 创建viewRootImpl,该方法会通过 WindowManagerGlobal.getWindowSession() 获取sessionroot = new ViewRootImpl(view.getContext(), display);view.setLayoutParams(wparams);// 添加到对应的数组mViews.add(view);mRoots.add(root);mParams.add(wparams);// do this last because it fires off messages to start doing thingstry {root.setView(view, wparams, panelParentView, userId);} catch (RuntimeException e) {// BadTokenException or InvalidDisplayException, clean up.if (index >= 0) {removeViewLocked(index, true);}throw e;}}}
这样完成了Activity View的加载。
相关文章:
frameworks 之 Activity添加View
frameworks 之 Activity添加View 1 LaunchActivityItem1.1 Activity 创建1.2 PhoneWindow 创建1.3 DecorView 创建 2 ResumeActivityItem 讲解 Activity加载View的时机和流程 涉及到的类如下 frameworks/base/core/java/android/app/Activity.javaframeworks/base/services/cor…...
Linux下Ollama下载安装速度过慢的解决方法
问题描述:在Linux下使用默认安装指令安装Ollama,下载安装速度过慢,进度条进度缓慢,一直处于Downloading Linux amd64 bundle中,具体如下图所示: 其中,默认的Ollama Linux端安装指令如下…...
【小白学HTML5】一文讲清常用单位(px、em、rem、%、vw、vh)
html5中,常用的单位有px、em、rem、%、vw、vh(不常用)、cm、m等,这里主要讲解px、em、rem、%、vw。 学习了解:主流浏览器默认的字号:font-size:16px,无论用什么单位,浏览器最终计算…...
用自定义注解实现Excel数据导入中的枚举值校验
使用自定义注解实现Excel数据导入中的枚举值校验 在实际开发中,我们经常需要从Excel文件中导入数据,并且这些数据需要符合一定的规则,比如某些字段的值必须是预定义的枚举值。本文将介绍如何使用自定义注解来实现这一功能,以提高…...
关于redis的主从复制(下)
目录 全量复制 关于replid和runid 部分复制 补充问题 实时复制 psync可以从主节点获取全量数据,也可以获取一部分数据。主要就是看offset的进度,如果offset写作-1,就是获取全量数据。offset写具体的正整数,则是从当前偏移量位…...
uniapp uni.request重复请求处理
类似这种切换tab时,如果操作很快并且网络不太好,就出现数据错乱,在网上查了一圈,有一个使用uview拦截处理的,但是原生uni.requse没有找到详细的解决办法,就查到使用 abort 方法,我自己封装了一个…...
【大模型】DeepSeek:AI浪潮中的破局者
【大模型】DeepSeek:AI浪潮中的破局者 引言:AI 新时代的弄潮儿DeepSeek:横空出世展锋芒(一)诞生背景与发展历程(二)全球影响力初显 探秘 DeepSeek 的技术内核(一)独特的模…...
SOME/IP--协议英文原文讲解8
前言 SOME/IP协议越来越多的用于汽车电子行业中,关于协议详细完全的中文资料却没有,所以我将结合工作经验并对照英文原版协议做一系列的文章。基本分三大块: 1. SOME/IP协议讲解 2. SOME/IP-SD协议讲解 3. python/C举例调试讲解 4.2 Speci…...
用PyInstaller构建动态脚本执行器:嵌入式Python解释器与模块打包 - 简明教程
技术场景: 需分发的Python工具要求终端用户可动态修改执行逻辑将Python环境与指定库(如NumPy/Pandas)嵌入可执行文件实现"一次打包,动态扩展"的轻量化解决方案。 ▌ 架构设计原理 1. 双模运行时识别 # 核心判断逻辑…...
在做题中学习(89):螺旋矩阵
解法:模拟 思路:创建ret数组,用变量标记原矩阵的行数和列数,遍历一个元素就push_back进ret数组,每次遍历完一行或一列,相应行/列数--,进行顺时针螺旋遍历到为0即可。 细节:要有边界…...
从零搭建微服务项目Base(第5章——SpringBoot项目LogBack日志配置+Feign使用)
前言: 本章主要在原有项目上添加了日志配置,对SpringBoot默认的logback的配置进行了自定义修改,并详细阐述了xml文件配置要点(只对日志配置感兴趣的小伙伴可选择直接跳到第三节),并使用Feign代替原有RestT…...
数据结构《图》
数据结构《图论》 图的性质 一、无向图(Undirected Graph) 定义 由一组顶点(Vertex)和一组无向边(Edge)构成。 每条无向边用一条无方向的线段连接两个顶点,记为 ( (u, v) ),其中…...
【数据分析】通过个体和遗址层面的遗传相关性网络分析
禁止商业或二改转载,仅供自学使用,侵权必究,如需截取部分内容请后台联系作者! 文章目录 介绍原理应用场景加载R包数据下载函数个体层面的遗传相关性网络分析导入数据数据预处理构建遗传相关性的个体网络对个体网络Nij进行可视化评估和选择最佳模型评估和选择最佳模型最佳模型…...
在 macOS 的 ARM 架构上按住 Command (⌘) + Shift + .(点)。这将暂时显示隐藏文件和文件夹。
在 macOS 的 ARM 架构(如 M1/M2 系列的 Mac)上,设置 Finder(访达)来显示隐藏文件夹的步骤如下: 使用快捷键临时显示隐藏文件: 在Finder中按住 Command (⌘) Shift .(点ÿ…...
【产品经理】需求分析方法论+实践
阐述了需求分析的基本认知,包括需求分析的定义、原则和内容。接着,文章详细介绍了需求分析的十个步骤,从收集需求到结果评审,为产品经理提供了清晰的操作指南。 作为产品经理,需求分析是一个最基本的工作,但…...
Windows平台的小工具,功能实用!
今天给大家分享一款超实用的Windows平台监控工具,堪称“桌面小管家”,能帮你轻松掌握电脑的各种运行状态,比如网速、下载速度、内存和CPU占用率等常用参数,让你的电脑运行情况一目了然。 TrafficMonitor 网速监控悬浮窗软件 这款…...
意图识别概述
在当今的人工智能领域,意图识别技术是自然语言处理(NLP)中的一个重要分支,它使得机器能够理解人类语言背后的目的或意图。对于鸿蒙操作系统而言,掌握意图识别技术可以极大地提升用户体验,使设备能更好地响应…...
54. c++类型转换
c是强类型语言,它有自己的类型系统,隐式类型转换是在类型转换时,自动转换且数据不丢失,显示类型转换是指定转换类型;在c风格的类型转换中 ,如下代码进行转换 #include <iostream>int main(int argc,…...
SAP-工单技术性关闭操作手册
文章目录 单个工单批量处理TECO和CLSD标识的区别 单个工单 事务代码CO02,输入工单号后回车 功能-》限制处理-》技术性完成 工单状态更改 撤销TECO操作 CO02输入工单号,功能-》限制处理-》撤销技术性完成 批量处理 事务代码COHV,点击生…...
Aseprite绘画流程案例(1)——画相机图标
原图: 步骤一:打开需要参照的图标 步骤二:将参照的图片拖放到右边,作为参考 步骤三:新建24x24的画布,背景为白色的画布 步骤四:点击菜单栏——视图——显示——像素网格(如果画布已经…...
RESTful 的特点与普通 Web API 的区别
RESTful 是一种设计风格,而不仅仅是普通的 Web API。它遵循一些特定的原则和约束,使得 API 更加简洁、可扩展和易于理解。以下是 RESTful 的特点,以及与普通 Web API 的区别: RESTful 的特点 1. 资源导向 RESTful API 的核心是资…...
安装海康威视相机SDK后,catkin_make其他项目时,出现“libusb_set_option”错误的解决方法
硬件:雷神MIX G139H047LD 工控机 系统:ubuntu20.04 之前运行某项目时,处于正常状态。后来由于要使用海康威视工业相机(型号:MV-CA013-21UC),便下载了并安装了该相机的SDK,之后运行…...
云计算架构学习之Ansible-playbook实战、Ansible-流程控制、Ansible-字典循环-roles角色
一、Ansible-playbook实战 1.Ansible-playbook安装软件 bash #编写yml [rootansible ansible]# cat wget.yml - hosts: backup tasks: - name: Install wget yum: name: wget state: present #检查playbook的语法 [rootansible ansible]…...
常用安全哈希算法bcrypt
文章目录 常用安全哈希算法bcrypt背景什么是哈希算法bcrypt哈希值验证在线工具编程方式 Bcrypt的原理 常用安全哈希算法bcrypt 背景 在设计一个系统的时候,肯定都有会有用户身份认证的问题,一般对用户校验的时候,都是对用户存在数据库总的密…...
Docker 常用命令基础详解(一)
一、Docker 初相识 在当今数字化时代,软件开发和部署的效率与灵活性成为了关键因素。Docker,作为一款开源的应用容器引擎,犹如一颗璀璨的明星,照亮了软件开发与部署的道路,为开发者们带来了前所未有的便利。它就像是一…...
网络工程师 (47)QOS
一、概念与原理 QOS即服务质量(Quality of Service)是一种网络技术,用于管理和保证网络中不同类型的质量和性能。它通过设置优先级和带宽限制等策略,确保关键应用(如视频会议、语音通信)的数据包能够在网络…...
glob 用法技巧
目录 处理大量文件节省内存 匹配多个文件扩展名 遍历多种格式文件 遍历某一个文件: 查找当前目录和子目录 6. 排除特定文件 7. 大小写不敏感匹配 8. 获取绝对路径 9. 处理特殊字符 处理大量文件节省内存 技巧:用 iglob 替代 glob,逐…...
Vue3 前端路由配置 + .NET8 后端静态文件服务优化策略
目录 一、Vue 前端配置(核心) 1. 配置 Vue Router 的 base 路径 2. 配置 Vue 的 publicPath 二、.NET 后端配置(关键) 1. 启用默认文档中间件 2. 配置静态文件服务的默认文档 三、验证访问路径 四、原理解释 五、常见问题…...
风铃摇晃的弧度与不安等长
晴,2025年2月19日 的确是,有依靠又有谁会去自己打伞。是啊,有时候生活推着我们走的样子确实挺无力的。不过谁都愿意携手走的,希望有一天再也不用“抛头露面”了吧。 又下载回了 X ,马上 Gork 3 可以使用,…...
Linux部署DeepSeek r1 模型训练
之前写过一篇windows下部署deepseekR1的文章,有小伙伴反馈提供一篇linux下部署DeepSeek r1 模型训练教程,在 Linux 环境下,我找了足够的相关资料,花费了一些时间,我成功部署了 DeepSeek R1 模型训练任务,结…...
