Android的常用Drawable讲解

今天来讲讲Android开发中水都绕不开的东西----drawable。最常使用的莫过于通过XML所声明的Drawable作为View背景,通过代码创建的应用场景则较少。其有着使用简单,比自定义view的成本要低的特点。同时,非图片类型的drawable占用空间较小,对减小apk的体积有很大的帮助。

Drawable其实是个抽象类,每种Drawable都是其子类。其分类主要包括:

image.gif
看着挺多,但其实按对应分类来了解,会发现很多都是一个类型,可举一反三。

ColorDrawable

最简单drawable,也是不怎么常用的,一般用于绘制一块单色区域。使用方式:

在xml的根结点中创建< color>,如下:

<?xml version="1.0" encoding="utf-8"?>
<color xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/white"/>

在代码中使用则是将要使用的色值作为参数传入其构造函数,示例表现则为:

ColorDrawable mColorDrawable = new ColorDrawable(0xff000000);

这里注意,传入的色值要写明透明度,如果省略透明度则默认代表透明。
例如,我们在AS默认生成的最简单HelloWorld工程中去设置中间的TextView背景,代码如下:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
	...
        TextView mTvNormal = findViewById(R.id.tv_normal);
        ColorDrawable mColorDrawable = new ColorDrawable(0x95798123);
        mTvNormal.setBackground(mColorDrawable);
}

其效果如下:

image.gif
当然,这种在代码中使用的用法并不常见,一般都是res/value目录下的color.xml中声明对应色值:

<?xml version="1.0" encoding="utf-8"?>  
<resources>  
    <color name="teal_200">#FF03DAC5</color>
    <color name="teal_700">#FF018786</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>
</resources>

使用方法太简单,这里不赘述了。

NinePatchDrawable

.9图片,是android平台的一种特殊格式,文件扩展名为.9.png。因为安卓系统根据屏幕尺寸会自动缩放图片,但这种缩放效果可能并不友好,有时我们只想缩放图片的某部分,为了实现这种效果,NinePatchDrawable应运而生。可自动根据宽高进行缩放且不会失真。最常见某信某Q里聊天软件里的会自适应拉伸的条目背景,实际使用则可以通过引用图片或者通过xml描述的方法(注意:BitmapDrawable修改src加载的图片为.9图片也可以做到同样效果)。如:

<?xml version="1.0" encoding="utf-8"?>
<nine-patch
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/icon_pic"
    android:antialias="true"
    android:dither="true"
    android:filter="true"
    android:gravity="center"
    android:mipMap="false"
    android:tileMode="disabled"
    />

当然,也可以通过代码来创建NinePatchDrawable。但几乎没人这样做,建议直接使用.9图片。

以上xml中各属性参数含义如下:

· android:src :引用图片资源。

· android:antialias :抗锯齿,图片会显得平滑但清晰度降低

· android:dither :是否进行抖动处理(即高质量图片在显示质量较低的屏幕上是否以较好的显示效果出现)

· android:filter :是否过滤,在图片拉伸压缩变形的时候保持好的显示效果。

· android:gravity :控制图片在容器里的显示位置。

· android:mipMap :是否采用纹理映射,图片处理的技术。

· android:tileMode :是否开启平铺模式,参数设置:1、disable关闭不开启,是默认选项;2、mirror:水平和竖直方向上镜面效果;3、repeat:水平和竖直平铺;4、clamp:四周的像素会扩散到周围区域。

以上xml参数几乎适合所有Drawable。

BitmapDrawable

最简单的drawable之一,表示一张图片。在开发时我们可以直接使用资源图片,也可以通过BitmapDrawable的方式来设置其达到更多效果:

<?xml version="1.0" encoding="utf-8"?>
<bitmap
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/ic_launcher_round"
    android:antialias="true"
    android:dither="true"
    android:filter="true"
    android:gravity="center"
    android:mipMap="false"
    android:tileMode="disabled"
    />

其效果为:

image.png

ShapeDrawable

最常见的Drawable类,对应是xml中的< shape>。一般用于满足日开发中的各种圆角矩形、渐变等产品经理的奇思妙想,增强用户体验(滑稽脸)。在xml中,shape作为头标签,又有orners、gradient、padding、size、soild、stroke这些子标签。其各种标签又有不同属性控制,其属性和对应含义如下:

1、shape属性:

表示图形形状。对应值为:

·rectangle:矩形,默认的形状。

·oval:椭圆

·line:横线

·ring:圆环

2、corners:

是否圆角。标签属性如下:

radius:为四个角同时指定圆角大小,也可以单独为每个角指定圆角。

topLeftRadius: 单独为左上角指定圆角大小。

topRightRadius:单独为右上角指定圆角大小。

bottomLeftRadius:单独为左下角指定圆角大小。

bottomRightRadius:单独为右下角指定圆角大小。

3、gradient:

是否渐变,与solid互斥,只能二选一(很好理解,gradient表示颜色渐变效果,solid表示颜色填充满效果,当然不难即填充又渐变啦)。标签属性如下:

angle属性:渐变角度,默认为0,代表从左往右渐变,数值必须为45的倍数。
90:从下到上渐变;
180:自右向左渐变;
270: 从上到下渐变

startColor、endColor:开始/结束时的渐变色

centerColor:渐变效果的中间颜色

useLevel:一般为false,当drawable作为StateListDrawable使用时则为true

type:渐变类型,共三种类型:
linear(线性渐变);
radial(径向渐变);
sweep(扫面线渐变)。

gradientRadius :渐变半径,当type设置为radial 时才有效。

solid:内部颜色填充效果,与gradient互斥,对应属性只有一个:
Color:填充色。

stroke:图形描边(可以理解为图片里画的线),当shape指定形状为line或ring时,必须通过这个stroke来指定线宽和颜色,否则无效。其属性如下:

width:所描边线宽度
color:所描边线颜色
dashWidth :所描边线为虚线,代表虚线宽度(与dashGap合用生效)
dashGap:虚线线段之间的间隔距离。(与dashWidth合用生效)

size:表示shape的大小,当容器有自己宽高的时候,shape会自适应view的宽高,size不会生效。而容器如果是自适应(wrap_content),则size会生效。其属性也简单,仅为了声明宽高:

width:shape的宽
height:shape的高

ring的特殊属性:当shape指定形状为ring时,属性有以下5个(只有ring才有的属性):

·innerRadioRatio:半径占整个drawable宽度的比例

·innerRadius:即圆环内半径,和innerRadioRatio同时存在时以innerRadius为准。

·ticknessRatio:厚度占整个drawable宽度的比例

·tickness:圆环厚度,即为外半径减去内半径的大小,和ticknessRatio同时存在时以ticknessRadius为准。

·useLevel 一般为false。

举个很简单的渐变例子,xml中代码如下:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:centerColor="#FFFFFF"
        android:startColor="#053FEC"
        android:endColor="#DFB109"/>
    <corners android:radius="10dp"/>
</shape>

则对应效果为圆角10dp的蓝黄渐变:

image.gif
当然,shape可做成的效果原不仅仅是这一个渐变,可组合效果太多太多,这里就不赘述了。

ClipDrawable

通过设置一个Drawable的当前显示的比例来裁剪显示出另一张Drawable的类,可以通过调节这个比例来控制裁剪的宽高,以及裁剪内容占整个容器的比例。说大白话就是可以做到类似Progress进度条的效果,具体方法为setLevel(),设置值范围在[0,10000]之间,值越大裁剪内容越少显示内容越多,setLevel(10000)时,完全显示(可想而知,0就是完全不显示了)。

让我们开始一个简单例子,先在res/drawable下声明bg_drawable_clip.xml:

<?xml version="1.0" encoding="utf-8"?>
<clip xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/img_demo">
</clip>

然后对应activity布局则为:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <ImageView
        android:id="@+id/iv_center"
        android:layout_alignParentTop="true"
        android:layout_width="match_parent"
        android:layout_height="333dp"
        android:background="@drawable/bg_drawable_clip"
        />
    <SeekBar
        android:id="@+id/seekbar"
        android:layout_below="@id/iv_center"
        android:layout_marginTop="20dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</RelativeLayout>

对应在Activity中关键代码则为:

ClipDrawable background = (ClipDrawable) mIvCenter.getBackground();
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        int level = seekBar.getMax();
        background.setLevel((int) (10000 * ((double)progress/(double)level)));
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {

    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {

    }
});

可见其效果:

Drawable- ClipDrawable拖动事件.gif

我们通过通过一个seekBar的进度来动态改变其setLevel中的值,最终让其显示不同的比例。当然也可以通过修改对应属性来调整他展开收缩的方向(竖直或者横向)。例如:

android:clipOrientation="vertical|horizontal"

由上面没有声明方向即是横向可以推断其默认方向为横向。竖向的例子这里就不赘述了。

RotateDrawable

看名字就能猜出来了,用于对Drawable的旋转。通过setLevel()来控制旋转程度,最大值为10000。其属性如下:

·android:fromDegrees:起始角度,对应最低的level值,默认为 0

·android:toDegrees:结束角度,对应最高的level值,默认为360

·android:pivotX:设置参照点的x坐标,取值为 0~1,默认是 50%,即 0.5

·android:pivotY:设置参照点的Y坐标,取值为 0~1,默认是 50%,即 0.5

·android:drawable:设置图片资源

·android:visible:是否可见

值得一提的是其角度计算方式坐标参考下图:

image.gif
可能看到最大值10000会让部分人产生疑惑,明明只有360度,10000是什么效果,其实setLevel是个相对度数,setLevel(360)可以理解为旋转一圈,setLevel(720)则是旋转俩圈,以此类推。

此Drawable可用ClipDrawable中的实例验证,修改下对应标签名和设置方法就行了,过于简单这里就不赘述了。你可能会发现,这个RotateDrawable跟RotateAnimation极其类似,都是旋转动画,那么对应Android的动画,是不是还有一个对应动画的Drawable?有的,就是AnimationDrawable。

AnimationDrawable

类似于Android的帧动画,用于把一系列的Drawable按照设置的顺序一帧一帧的播放。

其根结点为< animation-list>。< animation-list>可以有一个或多个< item>,每个< item>可设置属性如下:

android:oneshot :设置是否循环播放,false 则为循环播放(是不是有点不一样)
android:duration :每帧的间隔时间

使用方法:

其xml设置格式如下:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item
        android:drawable="@drawable/wave_1"
        android:duration="100" />
    <item
        android:drawable="@drawable/wave_2"
        android:duration="100" />
    <item
        android:drawable="@drawable/wave_3"
        android:duration="100" />
    <item
        android:drawable="@drawable/wave_4"
        android:duration="100" />
    <item
        android:drawable="@drawable/wave_5"
        android:duration="100" />
    <item
        android:drawable="@drawable/wave_6"
        android:duration="100" />
</animation-list>

在activity的布局文件中设置为ImageView的src,然后在Activity中通过ImageView.getDrawable()获取实例,然后start()即可播放动画。这里需要注意的是:在onCreate中直接调用,由于View还没初始化结束,是没有效果的。最好是postDelayed延迟播放。

由于其实例过于简单,这里不再赘述。

LayerDrawable

即图层叠加Drawable,可以说它是一个层次化显示的Drawable集合。通过显示多个Drawable的叠加、旋转、位移等组合显示出与单一Drawable不同的效果。LayerDrawable以 作为头节点。其子节点中属性如下:

android:drawable:引用的位图等资源,如果为空则必须有一个Drawable类型的子节点

android:left:这一个Drawable相对于容器的左边距,默认单位px

android:right:这一个Drawable相对于容器的右边距,默认单位px

android:top:这一个Drawable相对于容器的上边距,默认单位px

android:bottom:这一个Drawable相对于容器的下边距,默认单位px

android:id:赋予这一个drawable于 id,可用可不用。

在LayerDrawable中,每一个item表示一个Drawable,在效果上下面的Drawale覆盖上面的Drawable,item里面放的是各种Drawable。

例如,我们构建三层Drawable:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item>
        <shape>
            <solid android:color="@android:color/black"/>
        </shape>
    </item>
    <item
        android:bottom="10dp"
        android:left="10dp"
        android:right="10dp"
        android:top="10dp"
        >
        <shape>
            <solid android:color="@android:color/holo_red_dark"/>
            <stroke
                android:width="2dp"
                android:color="@android:color/holo_green_dark" />
            <corners android:radius="2dp"/>
        </shape>
    </item>
    <item
        android:bottom="10dp"
        android:left="10dp"
        android:right="10dp"
        android:top="10dp">
        <shape
            android:shape="oval">
            <solid android:color="@android:color/holo_blue_dark"/>
        </shape>
    </item>

</layer-list>

其Activity的布局为:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <ImageView
        android:id="@+id/iv_center"
        android:layout_width="222dp"
        android:layout_height="222dp"
        android:layout_centerInParent="true"
        android:background="@drawable/bg_normol_drawable"/>
</RelativeLayout>

不难猜到其显示效果为:

image.gif
当然,LayerDrawable可实现效果远不止这么点,你可多试试其他效果。

TransitionDrawable

是LayerDrawable 的一个子类,LayerDrawable 有的属性它几乎都有,但TransitionDrawable 只做管理两层的 Drawable 并且提供了相应透明度变化的动画,可以控制一层 Drawable 过度到另一层 Drawable 的动画效果。其根结点为< transition> ,且只有两个 < item>,设置好之后调用 startTransition() 可启动两层间的切换动画(还有个reverseTransition()反过来播放)。

我们用LayerDrawable 例子的drawable做一点小改动。

<?xml version="1.0" encoding="utf-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ic_launcher_round"/>
    <item android:drawable="@drawable/img_demo"/>
</transition>

对应activity中布局文件则为:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <ImageView
        android:id="@+id/iv_center"
        android:layout_width="222dp"
        android:layout_height="222dp"
        android:layout_centerInParent="true"
        android:src="@drawable/bg_normol_drawable"/>
</RelativeLayout>

Activity中对应代码则是:

ImageView mIvCenter = findViewById(R.id.iv_center);
TransitionDrawable drawable = (TransitionDrawable) mIvCenter.getDrawable();
drawable.startTransition(2000);

其效果为:

Drawable- Trans渐变动画.gif

LevelListDrawable

LevelListDrawable 也可以用于管理一组 Drawable,可以为里面的 drawable 设置不同的 level,通过根据不同的 level 属性值在其绘制的时候,获取对应的 drawable 绘制到画布上,其根结点为< level-list>。其每个item属性如下:

android:drawable:引用的图片资源,如果为空则必须有一个 Drawable 类型的子节点

android:minLevel:对应的最小值

android:maxLevel :对应的最大值

在Activity中获取对应ImageView,通过setImageLevel()来设置不同drawable。其使用方式与LayerDrawable这些差别不大,这里不再赘述。

其余Drawable都有其特殊使用方式和特定场景,但按照分类,都能通过以上例子举一反三。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/385143.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Github 2024-02-12 开源项目日报 Top10

根据Github Trendings的统计&#xff0c;今日(2024-02-12统计)共有10个项目上榜。根据开发语言中项目的数量&#xff0c;汇总情况如下&#xff1a; 开发语言项目数量Rust项目3Python项目3JavaScript项目1TypeScript项目1C项目1C项目1PowerShell项目1非开发语言项目1 SubQuery…

ctfshow-php特性(web102-web115)

目录 web102 web103 web104 web105 web106 web107 web108 web109 web110 web111 web112 web113 web114 web115 实践是检验真理的 要多多尝试 web102 <?php highlight_file(__FILE__); $v1$_POST[V1]; $v2$_GET[v2]; $v3$_GET[v3]; $v4is_numeric($v2)and is…

EMNLP 2023精选:Text-to-SQL任务的前沿进展(下篇)——Findings论文解读

导语 本文记录了今年的自然语言处理国际顶级会议EMNLP 2023中接收的所有与Text-to-SQL相关&#xff08;通过搜索标题关键词查找得到&#xff0c;可能不全&#xff09;的论文&#xff0c;共计12篇&#xff0c;包含5篇正会论文和7篇Findings论文&#xff0c;以下是对这些论文的略…

英语语法之句法(一)

英语语法可能是很多人童年的噩梦&#xff0c;笔者就是其中之一&#xff0c;从小学学到高中&#xff0c;这么多年从来没有理解过英语语法&#xff0c;什么谓语&#xff0c;非谓语&#xff0c;副词&#xff0c;状语&#xff0c;等等概念混淆在一起&#xff0c;傻傻分不清。本来以…

JavaScript 事件循环:Event Loop

&#x1f9d1;‍&#x1f393; 个人主页&#xff1a;《爱蹦跶的大A阿》 &#x1f525;当前正在更新专栏&#xff1a;《VUE》 、《JavaScript保姆级教程》、《krpano》、《krpano中文文档》 ​ ​ ✨ 前言 事件循环 是 web 开发中的一个核心概念&#xff0c;它是 JavaScript…

MyBatis篇----第二篇

系列文章目录 文章目录 系列文章目录前言一、MyBatis 框架适用场合二、MyBatis 与 Hibernate 有哪些不同?三、#{}和${}的区别是什么?四、当实体类中的属性名和表中的字段名不一样 ,怎么办?前言 前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一…

VScode上无法运行TSC命令,Typescript

如何解决问题 第一步&#xff1a;使用 winx 快捷键&#xff0c;会出现如下弹窗&#xff0c;鼠标左键单击Windows PowerShell 即可打开shell 第二步&#xff1a;运行 set-ExecutionPolicy RemoteSigned 命令&#xff0c;在询问更改执行策略的时候选择敲Y或者A 第三步&#xff…

博途PI控制器(完整SCL代码)

博途PID算法和SCL代码在PID专栏有详细介绍,这里作为参考补充和完善给出稍微不同的写法。给大家作为一个参考。增量式PID详细代码和算法公式可以参看下面链接文章: 博途增量式PID https://rxxw-control.blog.csdn.net/article/details/124363197https://rxxw-control.blog.c…

产品交付双轮驱动思维模型下的思考的研发工具

一、产品交付双轮驱动思维模型 之前读过这样双轮驱动思维模型&#xff0c;其思维模型如下图所示&#xff0c;双轮驱动思维模型是一个产品价值交付模型&#xff0c;总的理念是以“真北业务价值”为导向&#xff0c;以“产品快速交付”为动力&#xff0c;将“业务价值”与“产品…

【51单片机】串口(江科大)

8.1串口通信 1.串口介绍 2.硬件电路 3.电平标准 电平标准是数据1和数据0的表达方式,是传输线缆中人为规定的电压与数据的对应关系,串口常用的电平标准有如下三种: 电平标准是数据1和数据O的表达方式,是传输线缆中人为规定的电 压与数据的对应关系,串口常用的电平标准有如下…

GO语言笔记4-标识符、关键字与运算符

标识符 什么是标识符 变量名、方法名等我们起的名字都是标识符 标识符定义规则 字母、数字、下划线组成不可以数字开头&#xff0c;严格区分大小写&#xff0c;不能带有空格&#xff0c;不可以是go的关键字不能单独使用 下划线&#xff0c;因为下划线在GO中是一个特殊标识符&…

Excel一键导入导出-EasyPOI

EasyPOI是一款优秀的开源Java库&#xff0c;专为简化和优化Excel文件的导入导出操作而设计。下面&#xff0c;我会介绍EasyPOI在项目中使用EasyPOI&#xff0c;实现Excel文件的高效操作。帮助读者全面了解和掌握这一工具。 EasyPOI简介 官网&#xff1a; http://www.wupaas.co…

Android实现底部导航栏方法(Navigation篇)

Navigation实现底部导航栏 前言导入和基本使用导入基础使用创建nav文件编辑Nav文件添加页面&#xff08;代码版&#xff09;添加页面&#xff08;图解版&#xff09; 创建导航动作 action创建action&#xff08;代码版&#xff09;创建action&#xff08;图解版&#xff09; 编…

【数据结构】链表OJ面试题3《判断是否有环》(题库+解析)

1.前言 前五题在这http://t.csdnimg.cn/UeggB 后三题在这http://t.csdnimg.cn/gbohQ 记录每天的刷题&#xff0c;继续坚持&#xff01; 2.OJ题目训练 9. 给定一个链表&#xff0c;判断链表中是否有环。 力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成…

算法沉淀——链表(leetcode真题剖析)

算法沉淀——链表 01.两数相加02.两两交换链表中的节点03.重排链表04.合并 K 个升序链表05.K个一组翻转链表 链表常用技巧 1、画图->直观形象、便于理解 2、引入虚拟"头节点" 3、要学会定义辅助节点&#xff08;比如双向链表的节点插入&#xff09; 4、快慢双指针…

树状菜单(利用映射-bootstrap+jQuery实现折叠功能)

效果&#xff08;默认全部展开&#xff09;&#xff1a; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8" /><meta name"viewport" content"widthdevice-width, initial-scale1.0" /><…

一、Docker部署MySQL

Docker部署MySQL 一、安装Docker二、拉取MySQL镜像1.选择拉取版本2.拉取镜像 三、启动MySQL1.确定好挂载目录2.启动3.查看是否启动4.开启远程访问权限 一、安装Docker 安装教程&#xff1a;https://qingsi.blog.csdn.net/article/details/131270071 二、拉取MySQL镜像 1.选择…

【C语言】实现双向链表

目录 &#xff08;一&#xff09;头文件 &#xff08;二&#xff09; 功能实现 &#xff08;1&#xff09;初始化 &#xff08;2&#xff09;打印链表 &#xff08;3&#xff09; 头插与头删 &#xff08;4&#xff09;尾插与尾删 &#xff08;5&#xff09;指定位置之后…

html的格式化标签和图片(img)标签

格式化标签 加粗: strong标签和b标签倾斜: em标签和i标签删除线: del标签和s标签下划线: ins标签和u标签 <strong>stong 加粗</strong><b>b 加粗</b><em>倾斜</em><i>倾斜</i><del>删除线</del><s>删除线…

nodejs学习计划--(十)会话控制及https补充

一、会话控制 1.介绍 所谓会话控制就是 对会话进行控制 HTTP 是一种无状态的协议&#xff0c;它没有办法区分多次的请求是否来自于同一个客户端&#xff0c; 无法区分用户 而产品中又大量存在的这样的需求&#xff0c;所以我们需要通过 会话控制 来解决该问题 常见的会话控制…
最新文章