Android实例——自定义控件

news2024/9/29 1:21:43

自定义View

对现有控件进行扩展

案例一:添加背景

如下继承TextView

public class MyTextView extends androidx.appcompat.widget.AppCompatTextView {

    private Paint mPaint1;
    private Paint mPaint2;

    public MyTextView(Context context) {
        this(context, null);
    }

    public MyTextView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MyTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mPaint1 = new Paint();
        mPaint1.setColor(getResources().getColor(android.R.color.holo_blue_light));
        mPaint1.setStyle(Paint.Style.FILL);
        mPaint2 = new Paint();
        mPaint2.setColor(Color.YELLOW);
        mPaint2.setStyle(Paint.Style.FILL);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        //绘制蓝色外层矩形
        canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), mPaint1);
        //绘制黄色内层矩形
        canvas.drawRect(10, 10, getMeasuredWidth() - 10, getMeasuredHeight() - 10, mPaint2);
        canvas.save();
        //将文字平移10像素,避免遮挡
        canvas.translate(10, 0);
        super.onDraw(canvas);
        canvas.restore();
    }
}

在其onDraw()绘制文字之前,绘制两个不同的矩形背景,如下

在这里插入图片描述

案例二:文字闪动

如下继承TextView

public class MyTextView extends androidx.appcompat.widget.AppCompatTextView {

    private Paint mPaint;
    private int mViewWidth;
    private LinearGradient mLinearGradient;
    private Matrix mGradientMatrix;
    private int mTranslate = -mViewWidth;

    public MyTextView(Context context) {
        this(context, null);
    }

    public MyTextView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MyTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (mGradientMatrix != null) {
            mTranslate += mViewWidth / 5;   //每隔100毫秒加1/5
            if (mTranslate > 2 * mViewWidth) {  //实现循环,超过2倍宽,从头开始
                mTranslate = -mViewWidth;
            }
            mGradientMatrix.setTranslate(mTranslate, 0);//让矩阵不断平移
            mLinearGradient.setLocalMatrix(mGradientMatrix);//将矩阵设置到Gradient
            postInvalidateDelayed(100);
        }
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        if (mViewWidth == 0) {
            mViewWidth = getMeasuredWidth();
            if (mViewWidth > 0) {
                mPaint = getPaint();    //获取TextView的Paint
                mLinearGradient = new LinearGradient(0, 0, mViewWidth, 0,
                        new int[]{Color.BLUE, 0xffffffff, Color.BLUE},
                        null, Shader.TileMode.CLAMP);
                mPaint.setShader(mLinearGradient);//为其设置Shader
                mGradientMatrix = new Matrix();
            }
        }
    }
}

为TextView设置LinearGradient线性渐变,通过矩阵不断平移渐变效果,从而在绘制文字时,产生动态闪动效果

在这里插入图片描述

创建复合控件

如下创建一个标题栏TopBar,在res-values新建attrs.xml定义属性

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="TopBar">
        <attr name="title" format="string" />
        <attr name="titleTextSize" format="dimension" />
        <attr name="titleTextColor" format="color" />

        <attr name="leftTextColor" format="color" />
        <attr name="leftBackground" format="reference|color" />
        <attr name="leftText" format="string" />

        <attr name="rightTextColor" format="color" />
        <attr name="rightBackground" format="reference|color" />
        <attr name="rightText" format="string" />
    </declare-styleable>
</resources>

新建TopBar继承RelativeLayout,初始化属性-控件-点击事件-暴露方法

public class TopBar extends RelativeLayout {

    private int mLeftTextColor;
    private Drawable mLeftBackground;
    private String mLeftText;
    private int mRightTextColor;
    private Drawable mRightBackground;
    private String mRightText;
    private float mTitleTextSize;
    private int mTitleTextColor;
    private String mTitle;
    private Button mLeftButton;
    private Button mRightButton;
    private TextView mTitleView;
    private LayoutParams mLeftParams;
    private LayoutParams mRightParams;
    private LayoutParams mTitleParams;
    private topBarClickListener mListener;

    public TopBar(Context context) {
        this(context, null);
    }

    public TopBar(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TopBar(Context context, AttributeSet attrs, int defStyleAttr) {
        this(context, attrs, defStyleAttr, 0);
    }

    public TopBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        initAttrs(context, attrs);
        initView(context);
        initListener();
    }

    public interface topBarClickListener {
        void leftClick();

        void RightClick();
    }

    public void setOnTopBarClickListener(topBarClickListener listener) {
        this.mListener = listener;
    }

    public void setButtonVisible(int id, boolean flag) {
        if (flag) {
            if (id == 0) {
                mLeftButton.setVisibility(VISIBLE);
            } else {
                mRightButton.setVisibility(VISIBLE);
            }
        } else {
            if (id == 0) {
                mLeftButton.setVisibility(GONE);
            } else {
                mRightButton.setVisibility(GONE);
            }
        }
    }

    private void initListener() {
        mLeftButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mListener.leftClick();
            }
        });
        mRightButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mListener.RightClick();
            }
        });
    }

    private void initView(Context context) {
        mLeftButton = new Button(context);
        mRightButton = new Button(context);
        mTitleView = new TextView(context);

        mLeftButton.setTextColor(mLeftTextColor);
        mLeftButton.setBackground(mLeftBackground);
        mLeftButton.setText(mLeftText);

        mRightButton.setTextColor(mRightTextColor);
        mRightButton.setBackground(mRightBackground);
        mRightButton.setText(mRightText);

        mTitleView.setText(mTitle);
        mTitleView.setTextColor(mTitleTextColor);
        mTitleView.setTextSize(mTitleTextSize);
        mTitleView.setGravity(Gravity.CENTER);

        mLeftParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
        mLeftParams.addRule(ALIGN_PARENT_LEFT, TRUE);
        addView(mLeftButton, mLeftParams);

        mRightParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
        mRightParams.addRule(ALIGN_PARENT_RIGHT, TRUE);
        addView(mRightButton, mRightParams);

        mTitleParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
        mTitleParams.addRule(CENTER_IN_PARENT, TRUE);
        addView(mTitleView, mTitleParams);
    }

    private void initAttrs(Context context, AttributeSet attrs) {
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TopBar);
        mLeftTextColor = ta.getColor(R.styleable.TopBar_leftTextColor, 0);
        mLeftBackground = ta.getDrawable(R.styleable.TopBar_leftBackground);
        mLeftText = ta.getString(R.styleable.TopBar_leftText);

        mRightTextColor = ta.getColor(R.styleable.TopBar_rightTextColor, 0);
        mRightBackground = ta.getDrawable(R.styleable.TopBar_rightBackground);
        mRightText = ta.getString(R.styleable.TopBar_rightText);

        mTitleTextSize = ta.getDimension(R.styleable.TopBar_titleTextSize, 10);
        mTitleTextColor = ta.getColor(R.styleable.TopBar_titleTextColor, 0);
        mTitle = ta.getString(R.styleable.TopBar_title);
        ta.recycle();
    }

}

创建topbar.xml,指定命名空间app引用自定义属性

<?xml version="1.0" encoding="utf-8"?>
<com.demo.demo0.TopBar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/topBar"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    app:leftBackground="@color/colorPrimaryDark"
    app:leftText="Back"
    app:leftTextColor="#FFFFFF"
    app:rightBackground="@color/colorPrimaryDark"
    app:rightText="More"
    app:rightTextColor="#FFFFFF"
    app:title="自定义标题"
    app:titleTextColor="#123412"
    app:titleTextSize="10sp">
</com.demo.demo0.TopBar>

通过<include>引用

在这里插入图片描述

重写View实现全新控件

案例一:弧线展示图

public class MyView extends View {
    private Paint mCirclePaint, mArcRectPaint, mArcPaint, mTextPaint;

    private float length;
    private float mRadius;
    private RectF mArcRect;
    private float mCircleXY;
    private static final float DEFAULT_SWEEP_ANGLE = 245;
    private float mSweepAngle = DEFAULT_SWEEP_ANGLE;
    private String mShowText = mSweepAngle + "°";

    public MyView(Context context) {
        this(context, null);
    }

    public MyView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MyView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView();
    }

    private void initView() {
        mCirclePaint = new Paint();
        mCirclePaint.setColor(Color.parseColor("#55FF0000"));

        mArcRectPaint = new Paint();
        mArcRectPaint.setColor(Color.GRAY);

        mArcPaint = new Paint();
        mArcPaint.setColor(Color.parseColor("#AAFF0000"));
        mArcPaint.setStrokeWidth(100);
        mArcPaint.setStyle(Paint.Style.STROKE);

        mTextPaint = new Paint();
        mTextPaint.setColor(Color.BLACK);
        mTextPaint.setTextSize(50);
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        length = w;
        mCircleXY = length / 2;         //圆心 = (length / 2, length / 2)
        mRadius = (float) (length * 0.5 / 2);   //半径 = length / 4
        mArcRect = new RectF((float) (length * 0.1), (float) (length * 0.1),
                (float) (length * 0.9), (float) (length * 0.9));    //圆弧的内切矩形,上下去掉0.1length
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        //mArcPaint.setStrokeWidth(10);
        //canvas.drawRect(mArcRect, mArcRectPaint);   //用于展示内切矩形,了解原理
        canvas.drawCircle(mCircleXY, mCircleXY, mRadius, mCirclePaint); //画圆,传入圆心半径

        //画弧线,传入内切正方形,从270度即0点(0度位置在3点)开始顺时针转mSweepAngle角度,true会连接圆心,false只画边界
        canvas.drawArc(mArcRect, 270, mSweepAngle, false, mArcPaint);
        //画文字,传入文字,传入开始、结束位置、绘制在(x,y)处
        float textWidth = mTextPaint.measureText(mShowText); //测量文字宽度,为了让其居中
        canvas.drawText(mShowText, 0, mShowText.length(), mCircleXY - (textWidth / 2), mCircleXY + (textWidth / 4), mTextPaint);
    }

    public void setSweepAngle(float angle) {
        if (angle != 0) {
            mSweepAngle = angle;
        } else {
            mSweepAngle = DEFAULT_SWEEP_ANGLE;
        }
        invalidate();
    }
}

由一个圆、圆弧和文字组成,可通过setSweepAngle()设置显示比例

在这里插入图片描述

案例二:音频条形图

public class MyView extends View {

    private double mRandom;
    private int mWidth;
    private int mRectHeight;
    private int mRectWidth;
    private double mRectCount = 10;
    private Paint mPaint;
    private LinearGradient mLinearGradient;

    public MyView(Context context) {
        this(context, null);
    }

    public MyView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MyView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mPaint = new Paint();
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        mWidth = getWidth();        //View宽度
        mRectHeight = getHeight();  //View高度
        mRectWidth = (int) (mWidth * 0.6 / mRectCount); //第一个长方形的left坐标,为总宽度60%除以个数
        mLinearGradient = new LinearGradient(
                0,
                0,
                mRectWidth,
                mRectHeight,
                Color.YELLOW,
                Color.BLUE,
                Shader.TileMode.CLAMP); //左上角(0,0)到右下角(mRectWidth,mRectHeight)从黄到蓝的线性渐变
        mPaint.setShader(mLinearGradient);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        int offset = 5;
        for (int i = 0; i < mRectCount; i++) {
            mRandom = Math.random();
            float currentHeight = (float) (mRectHeight * mRandom);
            canvas.drawRect(
                    (float) (mWidth * 0.4 / 2 + mRectWidth * i + offset),   //left, mWidth * 0.4 / 2 为了居中, mRectWidth * i 计算每个长方形left, offset为空隙
                    currentHeight,  //top, 随机值
                    (float) (mWidth * 0.4 / 2 + mRectWidth * (i + 1)),  //right, mWidth * 0.4 / 2 为了居中, mRectWidth * (i + 1)计算每个长方形right
                    mRectHeight,    //bottom, 以左上角为原点计算
                    mPaint);
        }
        postInvalidateDelayed(300); //300ms后重绘实现动态显示
    }
}

onDraw()通过不断创建长方形并平移,实现模拟音频条的跳动

在这里插入图片描述

自定义ViewGroup

滑动组件

当子View上拉超过一定距离,松开后自动滑到下一个子View,下滑同理,布局如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ScrollViewActivity">

    <com.demo.demo0.MyScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#ff0000" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#00ff00" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#0000ff" />
    </com.demo.demo0.MyScrollView>
</LinearLayout>

通过触摸事件获取Y值坐标判断滑动

public class MyScrollView extends ViewGroup {

    private static final String TAG = MyScrollView.class.getSimpleName();
    private int mScreenHeight;
    private Scroller mScroller;
    private int mLastY;
    private int mStart;
    private int mEnd;

    public MyScrollView(Context context) {
        this(context, null);
    }

    public MyScrollView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        this(context, attrs, defStyleAttr, 0);
    }

    public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        initView(context);
    }

    private void initView(Context context) {
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(dm);
        mScreenHeight = dm.heightPixels;    //上面获取屏幕的高度
        mScroller = new Scroller(context);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        int childCount = getChildCount();
        MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams();
        mlp.height = mScreenHeight * childCount;    //父View实际高度=子View高度之和
        setLayoutParams(mlp);
        for (int i = 0; i < childCount; i++) {  //将图片依次拼接,摆放子View
            View child = getChildAt(i);
            if (child.getVisibility() != View.GONE) {
                child.layout(
                        l,
                        i * mScreenHeight,
                        r,
                        (i + 1) * mScreenHeight);
            }
        }
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        int count = getChildCount();
        for (int i = 0; i < count; ++i) {   //每个子View宽高等于ViewGroup显示宽高,即占满屏幕
            View childView = getChildAt(i);
            measureChild(childView, widthMeasureSpec, heightMeasureSpec);
        }
        setMeasuredDimension(widthMeasureSpec, heightMeasureSpec * count);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        int x = (int) event.getX();
        int y = (int) event.getY();
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mLastY = y;
                mStart = getScrollY();  //ScrollY是top向Y轴方向滚动的距离
                break;
            case MotionEvent.ACTION_MOVE:
                /*if (!mScroller.isFinished()) {
                    mScroller.abortAnimation();
                }*/
                int dy = mLastY - y;
                Log.d(TAG, "onTouchEvent: dy = " + dy);
                if (getScrollY() < 0) { //已经滑到第一个
                    dy = 0;
                }
                if (getScrollY() > (getChildCount() - 1) * mScreenHeight) {  //已经滑到最后一个
                    dy = 0;
                }
                scrollBy(0, dy);
                mLastY = y;     //实时更新滑动坐标,计算偏移量
                break;
            case MotionEvent.ACTION_UP:
                mEnd = getScrollY();
                int dScrollY = mEnd - mStart;
                Log.d(TAG, "onTouchEvent: getScrollY() = " + getScrollY());
                Log.d(TAG, "onTouchEvent: dScrollY = " + dScrollY);
                if (dScrollY > 0) {//向下滑动
                    //超过屏幕高度的1/3,则展示上一张图片,否则反弹显示当前图片
                    if (dScrollY < mScreenHeight / 3) {
                        mScroller.startScroll(
                                0, getScrollY(),
                                0, -dScrollY);
                    } else {
                        mScroller.startScroll(
                                0, getScrollY(),
                                0, mScreenHeight - dScrollY);
                    }
                } else {
                    if (-dScrollY < mScreenHeight / 3) {
                        mScroller.startScroll(
                                0, getScrollY(),
                                0, -dScrollY);
                    } else {
                        mScroller.startScroll(
                                0, getScrollY(),
                                0, -mScreenHeight - dScrollY);
                    }
                }
                break;
        }
        postInvalidate();
        return true;
    }

    @Override
    public void computeScroll() {
        super.computeScroll();
        if (mScroller.computeScrollOffset()) {
            scrollTo(0, mScroller.getCurrY());
            postInvalidate();
        }
    }
}

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

wireshark抓包新手使用教程(超详细)

一、简介 Wireshark是一款非常流行的网络封包分析软件&#xff0c;可以截取各种网络数据包&#xff0c;并显示数据包详细信息。 为了安全考虑&#xff0c;wireshark只能查看封包&#xff0c;而不能修改封包的内容&#xff0c;或者发送封包。 wireshark能获取HTTP&#xff0c;也…

day47-Testimonial Box Switcher(推荐箱切换器-动态进度条自动更新卡片信息)

50 天学习 50 个项目 - HTMLCSS and JavaScript day47-Testimonial Box Switcher&#xff08;推荐箱切换器-动态进度条自动更新卡片信息&#xff09; 效果 index.html <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"…

Docker续集+Docker Compose

目录 Containerd与docker的关系 runCrunC与Containerd的关联 OCI协议Dockerfile多阶段构建&#xff08;解决&#xff1a;如何让一个镜像变得更小 &#xff09;多阶段构建Images瘦身实践.dockerignore Docker Compose快速开始Quick StartCompose 命令常用命令命令说明 Compose 模…

11. Mybatis 的增删查改【万字详解】

目录 1. 数据的查找 select 1.1 查询所有数据 1.2 通过 id 进行查找 2. 插入数据 insert 3. 修改数据 update 4. 删除数据 delete 5. $ 和 # 的区别 5.1 SQL 注入 用户登录 6. Spring Boot 打印 SQL 日志 7. order by 排序 8. like 查询 9. 通过页面返回数据 10. …

C++--菱形继承

1.什么是菱形继承 单继承&#xff1a;一个子类只有一个直接父类时称这个继承关系为单继承 多继承&#xff1a;一个子类有两个或以上直接父类时称这个继承关系为多继承 菱形继承的问题&#xff1a;菱形继承有数据冗余和二义性的问题&#xff0c;数据冗余是由于创建多个相同类型的…

【C++】优先级队列的基本概念以及其模拟实现

文章目录 补充知识&#xff1a;仿函数一、优先级队列&#xff1a;1.引入2.介绍 二、priority_queue的模拟实现1.大体框架2.私有成员函数&#xff1a;1.向下调整&#xff08;AdjustDown&#xff09;2.向上调整&#xff08;AdjustUp&#xff09; 3.公有成员函数1大小&#xff08;…

Windows驱动第一节(什么是驱动?)

本文来自微软,由本人兴趣爱好人工翻译(非机翻) What is a driver? - Windows drivers | Microsoft Learn 我想很难给驱动这个词一个准确的定义.最基础的定义是驱动是一个用于让操作系统和硬件设备通信的软件组件. 举一个例子,假设一个应用程序需要从硬件设备读取一些数据,这…

2023河南萌新联赛第(三)场:郑州大学 A - 发工资咯

2023河南萌新联赛第&#xff08;三&#xff09;场&#xff1a;郑州大学 A - 发工资咯 时间限制&#xff1a;C/C 2秒&#xff0c;其他语言4秒 空间限制&#xff1a;C/C 262144K&#xff0c;其他语言524288K 64bit IO Format: %lld 题目描述 一个公司有n个人&#xff0c;每个月都…

C++类与对象 - 3(拷贝构造函数和运算符重载)(超详细)

C类与对象 - 3 1. 拷贝构造函数1.1 概念1.2 特征 2. 赋值运算符重载2.1 运算符重载2.2 赋值运算符重载记点2.3 前置和后置重载 3. const成员函数记点 4. 取地址及const取地址操作符重载 1. 拷贝构造函数 1.1 概念 在现实生活中&#xff0c;可能存在一个与你一样的自己&#x…

RK3566 android代码编译

一、搭建环境 所用的ubuntu系统之前已编译过linux代码&#xff0c;所以只需安装编译android所需的环境。 安装jdk-8 如果之前系统没有安装则执行以下命令安装&#xff1a; sudo apt-get install openjdk-8-jdk 查看当前系统是否有jdk-8 $ sudo update-alternatives --conf…

奇舞周刊第 501 期:前端打包加个性能插件检测~ 性能不过关就发邮件告诉领导!...

记得点击文章末尾的“ 阅读原文 ”查看哟~ 下面先一起看下本期周刊 摘要 吧~ 奇舞推荐 ■ ■ ■ 前端打包加个性能插件检测~ 性能不过关就发邮件告诉领导&#xff01; 本文作者结合 Lighthouse 是一个开源的自动化工具&#xff0c;给组内的项目都在 CICD 流程上更新上了性能守卫…

每日一博 - How To Improve API Performance

文章目录 包括但局限于以下措施1. 采用分页显示2. 异步记录日志3. 利用缓存技术4. 实施负载压缩5. 管理数据库连接池 包括但局限于以下措施 1. 采用分页显示 当查询结果过多时&#xff0c;将结果分为多个页面进行显示&#xff0c;可以有效地提高系统的响应速度。这样&#xff…

高效率,38V最大输入单电感同步升/降稳压器SYV939C

SYV939是一种高压同步降压-升压转换器。该器件工作在4V至28V的宽输入电压范围内&#xff0c;具有10max平均电感电流能力。四个集成的低RDS(ON)开关最大限度地减少了传导损耗。 SYV939c包括完整的保护功能&#xff0c;如输出过流/短路保护&#xff0c;过压保护和热停机&#xff…

找到刀郎《罗刹海市》--微信小程序调用地图--【小程序花园】

微信目录集链接在此&#xff1a; 详细解析黑马微信小程序视频–【思维导图知识范围】难度★✰✰✰✰ 不会导入/打开小程序的看这里&#xff1a;参考 让别人的小程序长成自己的样子-更换window上下颜色–【浅入深出系列001】 文章目录 本系列校训学习资源的选择地图在小程序里…

数据库的下一个变革方向——云原生数据库

快速上手亚马逊云原生数据库 数据库免费试用及在线大会 亚马逊数据库产品支持免费试用&#xff0c;并且提供上手教程。【数据库免费试用&上手教程】 回看人类历史上每一次技术的跨越&#xff0c;生产力变革永远不会缺席。“云原生数据库”也已经悄然走到了第十个年头。未…

RabbitMQ 教程 | 客户端开发向导

&#x1f468;&#x1f3fb;‍&#x1f4bb; 热爱摄影的程序员 &#x1f468;&#x1f3fb;‍&#x1f3a8; 喜欢编码的设计师 &#x1f9d5;&#x1f3fb; 擅长设计的剪辑师 &#x1f9d1;&#x1f3fb;‍&#x1f3eb; 一位高冷无情的编码爱好者 大家好&#xff0c;我是 DevO…

后台管理系统中常见的三栏布局总结:使用element ui构建

vue2 使用 el-menu构建的列表布局&#xff1a; 列表可以折叠展开 <template><div class"home"><header><el-button type"primary" click"handleClick">切换</el-button></header><div class"conte…

Arcgis画等高线

目录 数据准备绘制等高线3D等高线 今天我们将学习如何在ArcGIS中绘制等高线地图。等高线地图是地理信息系统中常见的数据表现形式&#xff0c;它通过等高线将地形起伏展现得一目了然&#xff0c;不仅美观&#xff0c;还能提供重要的地形信息。 数据准备 在开始之前&#xff0c…

【javaSE】 类和对象详解

目录 面向对象的初步认知 什么是面向对象 面向对象与面向过程 类定义和使用 简单认识类 类的定义格式 注意事项 练习定义类 定义一个狗类 定义一个学生类 注意事项 类的实例化 什么是实例化 注意事项 类和对象的说明 this引用 为什么要有this引用 什么是this引…

FSM:Full Surround Monodepth from Multiple Cameras

参考代码&#xff1a;None 介绍 深度估计任务作为基础环境感知任务&#xff0c;在基础上构建的3D感知才能更加准确&#xff0c;并且泛化能力更强。单目的自监督深度估计已经有MonoDepth、ManyDepth这些经典深度估计模型了&#xff0c;而这篇文章是对多目自监督深度估计进行探…