简单的自定义 View,xmlns 作用,属性动画。

简介: 简单的自定义 View,xmlns 作用,属性动画。

实现TextView拖拽显示



layout:


<LinearLayout
    android:id="@+id/rl"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/logo"
        android:text="张"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.497"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.425"
        />
</LinearLayout>

tv.setOnTouchListener(new View.OnTouchListener() {
            int orgX, orgY;
            int offsetX, offsetY;
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        orgX = (int) event.getX();
                        orgY = (int) event.getY();
                        Log.d("TAG", "onTouch: orgX=="+orgX);
                        Log.d("TAG", "onTouch: orgY=="+orgY);
                        break;
                    case MotionEvent.ACTION_MOVE:
                        offsetX = (int) event.getRawX() - orgX;
                        offsetY = (int) event.getRawY() - orgY;
                        Log.d("TAG", "onTouch: event.getRawX()=="+event.getRawX());
                        Log.d("TAG", "onTouch: event.getRawY()=="+event.getRawY());
                        Log.d("TAG", "offsetX: offsetX=="+offsetX);
                        Log.d("TAG", "offsetY: offsetY=="+offsetY);
                        LinearLayout.LayoutParams p1 = (LinearLayout.LayoutParams) relativeLayout.getLayoutParams();
                        p1.topMargin = offsetY;//设置像素
                        p1.leftMargin = offsetX;//设置像素
                        relativeLayout.setLayoutParams(p1);
                        break;
                }
                return true;
            }
        });

补充:getRawX和get的区别



getX()是表示Widget相对于自身左上角的x坐标。


getRawX()是表示相对于屏幕左上角的x坐标值,这个屏幕左上角是手机屏幕左上角,不管activity是否有titleBar或是否全屏幕。


简单的自定义 View



package com.example.ceshi;
import android.content.Context;
import android.content.res.TypedArray;
/**
 * @ProjectName: ceshi
 * @Package: com.example.ceshi
 * @ClassName: MyView
 * @Description: java类作用描述
 * @Author: 作者名
 * @CreateDate: 2020/7/30 0030 下午 5:22
 * @UpdateUser: 更新者:
 * @UpdateDate: 2020/7/30 0030 下午 5:22
 */
public class MyView extends View {
    private Paint myPaint;
    private Paint myPaint1;
    private static final String myString = "Hello CustomView!";
    public MyView(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
    }
    int bg;
    String text;
    int textColor1;
    public MyView(Context context, AttributeSet attr) {
        super(context, attr);
        myPaint = new Paint();
        TypedArray a = context.obtainStyledAttributes(attr, R.styleable.myView);//TypedArray是一个数组容器
        float textSize = a.getDimension(R.styleable.myView_textSize, 30);//防止在XML文件里没有定义,就加上了默认值30
        int textColor = a.getColor(R.styleable.myView_textColor, 0x34343434);//同上,这里的属性是:名字_属性名
        textColor1 = a.getColor(R.styleable.myView_textColor1, 0x34343434);//同上,这里的属性是:名字_属性名
        bg = a.getColor(R.styleable.myView_backg, 0xdd0000);//同上,这里的属性是:名字_属性名
        text = a.getString(R.styleable.myView_text);
        myPaint.setTextSize(textSize);
        myPaint.setColor(textColor);
        a.recycle();//我的理解是:
        // 返回以前取回的属性,供以后使用。以前取回的可能就是textSize和textColor初始化的那段
    }
    /**
     * @param canvas
     */
    @Override
    protected void onDraw(Canvas canvas) {
        // TODO Auto-generated method stub
        super.onDraw(canvas);
        myPaint1 = new Paint();
        myPaint1.setColor(textColor1);
        myPaint1.setColor(Color.BLUE);
        canvas.drawCircle(500, 500, 200, myPaint1);
        canvas.drawCircle(500, 500, 100, myPaint);
        canvas.drawText(text, 0, 0, myPaint);
    }
}

layout:


<?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:tes="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <com.example.ceshi.MyView
        android:id="@+id/mv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tes:text="zhangjiqun"
        tes:textColor="#ff0000"
        tes:textColor1="#FFF283"
        tes:textSize="50px">
        <TextView
            android:id="@+id/tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="张"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="0.497"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.425"
            tools:text="张 " />
    </com.example.ceshi.MyView>
</LinearLayout>

调用并实现动画:


package com.example.ceshi;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
/**
 *
 */
public class MainActivity extends AppCompatActivity   {
    private TextView tv;
    Handler handler = new Handler() {
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                case 1:
                    tv.setText(111 + "");
                    break;
                case 2:
                    tv.setText(222 + "");
                    break;
                case 3:
                    tv.setText(333 + "");
                    break;
                case 4:
                    tv.setText(444 + "");
                    break;
                case 5:
                    tv.setText(555 + "");
                    break;
            }
        }
    };
    private ProgressDialog processDialog;
    /**
     * @param savedInstanceState
     */
    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = (TextView) findViewById(R.id.tv);
        final MyView myView=findViewById(R.id.mv);
        myView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,"123",
                        Toast.LENGTH_SHORT).show();
            }
        });
        handler.sendEmptyMessageDelayed(1, 1000);
        handler.sendEmptyMessageDelayed(2, 2000);
        handler.sendEmptyMessageDelayed(3, 3000);
        handler.sendEmptyMessageDelayed(4, 4000);
        handler.sendEmptyMessageDelayed(5, 5000);
        tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this, MainActivityt.class);
                startActivity(intent);
            }
        });
        ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(
                myView, "alpha", 1f, 0f, 1f);
        objectAnimator.setDuration(2000).setStartDelay(100); ;
        objectAnimator.setRepeatCount(1000);
        objectAnimator.setRepeatMode(ValueAnimator.RESTART);
        objectAnimator.start();
        ObjectAnimator objectAnimator1=ObjectAnimator.ofFloat(myView,
                "rotation",0f,360f);
        myView.setPivotX(400);
        myView.setPivotY(400);
        objectAnimator1.setRepeatCount(1000);
        objectAnimator1.setDuration(500).start();
        float fl=myView.getTranslationX();
        ObjectAnimator objectAnimator2=ObjectAnimator.ofFloat(myView,
                "scale",1f,3f,1f);
        objectAnimator2.setDuration(2000).setRepeatCount(2000);
        objectAnimator2.start();
        ObjectAnimator objectAnimator3=ObjectAnimator.ofFloat(myView,
                "scaleX",1f,3f,1f);
        objectAnimator3.setDuration(2000).setRepeatCount(2000);
        objectAnimator3.start();
        String a = "123";
        tv.setText(a);
        try {
            Test();
        } catch ( ServiceException e ) {
//            e.printStackTrace();
            waitCloseAlert("执行线程异常,原因:"+e.getMessage());
        }
    }
    public static void Test()throws ServiceException
    {
        throw new ServiceException("怎么说");
    }
    /**
     * 关闭等待警告提示
     * */
    public void waitCloseAlert(final String message) {
        MainActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (processDialog != null && processDialog.isShowing()) {
                    processDialog.dismiss();
                }
                showAlertDialog(message,null,R.drawable.ic_launcher_background,null);
            }
        });
    }
    public void showAlertDialog(String title,String message,Integer icon,final View focusView){
        AlertDialog.Builder builder=new AlertDialog.Builder(this);
        if(title!=null){
            builder.setTitle(title);
        }
        if(message!=null){
            builder.setMessage(message);
        }
        if(icon!=null){
            builder.setIcon(icon);
        }
        builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if(focusView!=null){
                    focusView.requestFocus();
                }
            }
        });
        AlertDialog dialog = builder.create();
        dialog.show();
    }
}

xmlns 作用



xmlns:android="schemas.android.com/apk/res/and…


这个是xml的命名空间,也可以理解为语法文件。或者语法判断器什么的;
这个主要作用是在运行的时候那些控件的属性都是通过它来识别的,如果上面你写错了,不会有任何问题,但是在运行的时候就会有问题,提示你没有指定宽度等什么。这个是不用联网的。

自定义xmlns:xmlns:tes="http://schemas.android.com/apk/res-auto"


50a487fddb804000ae5f355b62352849_tplv-k3u1fbpfcp-zoom-in-crop-mark_4536_0_0_0.png


xmlns 使用,下面有两种形式,现在一般使用直接 res-auto;


6b6315b706ad4ea38de09468400c301c_tplv-k3u1fbpfcp-zoom-in-crop-mark_4536_0_0_0.png

Android attrs文件(自定义)属性详解



<!-- declare-styleable表示为自定义的属性-->
<!-- format表示为可接受的参数类型-->
<!--integer int型-->
<!--boolean boolean-->
<!--color 颜色-->
<!--dimension 尺寸-->
<!--enum 枚举-->
<!--flag 位或运算-->
<!--float float型-->
<!--fraction 百分数-->
<!--reference 资源文件-->
<!--string 字符串-->
<declare-styleable name="MyView">
    <attr name="a" format="integer"></attr>
    <attr name="b" format="boolean"></attr>
    <attr name="c" format="color"></attr>
    <attr name="d" format="dimension"></attr>
    <attr name="e"></attr>
    <attr name="f"></attr>
    <attr name="g" format="float"></attr>
    <attr name="h" format="fraction"></attr>
    <attr name="i" format="reference"></attr>
    <attr name="j" format="string"></attr>
</declare-styleable>
<attr name="e">
    <enum name="e1" value="1"></enum>
    <enum name="e2" value="2"></enum>
</attr>
<attr name="f">
    <flag name="f1" value="1"></flag>
    <flag name="f2" value="2"></flag>
</attr>

在layout头部设置:


xmlns:tes="http://schemas.android.com/apk/res-auto"

使用:


tes:textColor="#ff0000"

1 reference:参考某一资源ID

主要是使用一些图片资源的时候使用reference;


<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="myView">
        <attr name="backg" format="color" />
        <attr name="textColor" format="color"  />
        <attr name="textColor1" format="color"  />
        <attr name="textSize" format="dimension" />
        <attr name="text" format="string" />
        <attr name="draw" format="reference" />
    </declare-styleable>
</resources>
layout:
    <com.example.ceshi.MyView
        android:id="@+id/mv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tes:draw="@drawable/ic_launcher_background"
        tes:text="zhangjiqun"
        tes:textColor="#ff0000"
        tes:textColor1="#FFF283"
        tes:textSize="50px">
    </com.example.ceshi.MyView>
复制代码

draw = a.getResourceId(R.styleable.myView_draw, R.drawable.ic_launcher_background);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_background);
canvas.drawBitmap(mBitmap,100,100,myPaint);

整体:


package com.example.ceshi;
import android.content.Context;
/**
 * @ProjectName: ceshi
 * @Package: com.example.ceshi
 * @ClassName: MyView
 * @Description: java类作用描述
 * @Author: 作者名
 * @CreateDate: 2020/7/30 0030 下午 5:22
 * @UpdateUser: 更新者:
 * @UpdateDate: 2020/7/30 0030 下午 5:22
 */
public class MyView extends View {
    private Paint myPaint;
    private Paint myPaint1;
    private static final String myString = "Hello CustomView!";
    public MyView(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
    }
    int bg;
    String text;
    int textColor1;
    int draw;
    public MyView(Context context, AttributeSet attr) {
        super(context, attr);
        myPaint = new Paint();
        TypedArray a = context.obtainStyledAttributes(attr, R.styleable.myView);//TypedArray是一个数组容器
        float textSize = a.getDimension(R.styleable.myView_textSize, 30);//防止在XML文件里没有定义,就加上了默认值30
        int textColor = a.getColor(R.styleable.myView_textColor, 0x34343434);//同上,这里的属性是:名字_属性名
        draw = a.getResourceId(R.styleable.myView_draw, R.drawable.ic_launcher_background);//同上,这里的属性是:名字_属性名
        textColor1 = a.getColor(R.styleable.myView_textColor1, 0x34343434);//同上,这里的属性是:名字_属性名
        bg = a.getColor(R.styleable.myView_backg, 0xdd0000);//同上,这里的属性是:名字_属性名
        text = a.getString(R.styleable.myView_text);
        myPaint.setTextSize(textSize);
        myPaint.setColor(textColor);
        a.recycle();//我的理解是:
        // 返回以前取回的属性,供以后使用。以前取回的可能就是textSize和textColor初始化的那段
    }
    /**
     * @param canvas
     */
    @Override
    protected void onDraw(Canvas canvas) {
        // TODO Auto-generated method stub
        super.onDraw(canvas);
        myPaint1 = new Paint();
        myPaint1.setColor(textColor1);
        myPaint1.setColor(Color.BLUE);
        canvas.drawCircle(500, 500, 200, myPaint1);
        canvas.drawCircle(500, 500, 100, myPaint);
        canvas.drawText(text, 0, 0, myPaint);
        Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), draw);
        canvas.drawBitmap(mBitmap,100,100,myPaint);
    }
}

补充:drawable 转bitmap 空指针


Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_background);

上面这个是空指针,原因是这个资源文件是xml;


Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.logo);

所以这个BitmapFactory必须使用图片资源才是可以的;


2 color:颜色值


<declare-styleable name = "名称">
       <attr name = "textColor" format = "color" />
</declare-styleable>
eg:
 <TextView
     android:layout_width = "42dip"
     android:layout_height = "42dip"
     android:textColor = "#00FF00"
                     />

补充:setColor方法:设置颜色



Color.RED:红色。
Color.TRANSPARENT:透明。
Color.WHITE:白色。
RGB颜色设置方法
setColor(new Color(int r,int g,int b))
例如  setColor(new Color(220,255,220))

3 boolean:布尔值


<declare-styleable name = "名称">
      <attr name = "focusable" format = "boolean" />
</declare-styleable>
eg:
<Button
    android:layout_width = "42dip"
    android:layout_height = "42dip"
    android:focusable = "true"/>

4 dimension:尺寸值


<declare-styleable name = "名称">
     <attr name = "layout_width" format = "dimension" />
</declare-styleable>
eg:
<com.lizi.newset.CustomView.attrs.MyView
        android:id="@+id/myView"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        test:textSize="50px"
        test:textColor="#ff00ff"/>

5 float:浮点值


<declare-styleable name = "AlphaAnimation">
      <attr name = "fromAlpha" format = "float" />
      <attr name = "toAlpha" format = "float" />
</declare-styleable>
eg:
<alpha
       android:fromAlpha = "1.0"
       android:toAlpha = "0.7"
/>

6 string:字符串


<declare-styleable name = "MapView">
     <attr name = "apiKey" format = "string" />
</declare-styleable>
eg:
<com.google.android.maps.MapView
         android:layout_width = "fill_parent"
         android:layout_height = "fill_parent"
         android:apiKey = "0jOkQ80oD1JL9C6HAja99uGXCRiS2CGjKO_bc_g"
                    />

7 integer:整型值 || fraction:百分数


<declare-styleable name = "AnimatedRotateDrawable">
      <attr name = "visible" />
      <attr name = "frameDuration" format="integer" />
      <attr name = "framesCount" format="integer" />
      <attr name = "pivotX"  format = "fraction"/>
      <attr name = "pivotY"  format = "fraction"/>
      <attr name = "drawable" />
</declare-styleable>
eg:
<animated-rotate
      xmlns:android = "http://schemas.android.com/apk/res/android"  
      android:drawable = "@drawable/图片ID"  
      android:pivotX = "50%"  
      android:pivotY = "50%"  
      android:framesCount = "12"  
      android:frameDuration = "100"
  />

8 enum:枚举值


<declare-styleable name="名称">
                   <attr name="orientation">
                          <enum name="horizontal" value="0" />
                          <enum name="vertical" value="1" />
                   </attr>            
</declare-styleable>
eg:
<LinearLayout
                    xmlns:android = "http://schemas.android.com/apk/res/android"
                    android:orientation = "vertical"
                    android:layout_width = "fill_parent"
                    android:layout_height = "fill_parent"
                    >
</LinearLayout>

9 flag 位或运算


<declare-styleable name="名称">
                    <attr name="windowSoftInputMode">
                            <flag name = "stateUnspecified" value = "0" />
                            <flag name = "stateUnchanged" value = "1" />
                            <flag name = "stateHidden" value = "2" />
                            <flag name = "stateAlwaysHidden" value = "3" />
                            <flag name = "stateVisible" value = "4" />
                            <flag name = "stateAlwaysVisible" value = "5" />
                            <flag name = "adjustUnspecified" value = "0x00" />
                            <flag name = "adjustResize" value = "0x10" />
                            <flag name = "adjustPan" value = "0x20" />
                            <flag name = "adjustNothing" value = "0x30" />
                     </attr>         
</declare-styleable>
eg:
<activity
      android:name = ".StyleAndThemeActivity"
      android:label = "@string/app_name"
      android:windowSoftInputMode = "stateUnspecified | stateUnchanged | stateHidden">
      <intent-filter>
            <action android:name = "android.intent.action.MAIN" />
            <category android:name = "android.intent.category.LAUNCHER" />
      </intent-filter>
</activity>

属性定义时可以同时定义多种类型值



<declare-styleable name = "名称">
      <attr name = "background" format = "reference|color" />
</declare-styleable>
eg:
<ImageView
        android:layout_width = "42dip"
        android:layout_height = "42dip"
        android:background = "@drawable/图片ID|#00FF00"
        />

Error:(246, 5) error: invalid value '??' for ; must be an integer.


这个错诶就是在attrs中你有的地方赋值类型不对,仔细看看,我的 是有一个空格,但是类型是int;仔细检查;


Error:(369) duplicate value for resource 'attr/background' with config ''.

这是由于background这个值重复了,一般的都有这个数值,你改个名字;


属性动画:



旋转,缩放,透明度


ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(
                myView, "alpha", 1f, 0f, 1f);
        objectAnimator.setDuration(2000).setStartDelay(100); ;
        objectAnimator.setRepeatCount(1000);
        objectAnimator.setRepeatMode(ValueAnimator.RESTART);
        objectAnimator.start();
        ObjectAnimator objectAnimator1=ObjectAnimator.ofFloat(myView,
                "rotation",0f,360f);
        myView.setPivotX(400);
        myView.setPivotY(400);
        objectAnimator1.setRepeatCount(1000);
        objectAnimator1.setDuration(500).start();
        float fl=myView.getTranslationX();
        ObjectAnimator objectAnimator2=ObjectAnimator.ofFloat(myView,
                "scale",1f,3f,1f);
        objectAnimator2.setDuration(2000).setRepeatCount(2000);
        objectAnimator2.start();
        ObjectAnimator objectAnimator3=ObjectAnimator.ofFloat(myView,
                "scaleX",1f,3f,1f);
        objectAnimator3.setDuration(2000).setRepeatCount(2000);
        objectAnimator3.start();

Android动态添加View之addView



layout:


<LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="66dp"
        android:orientation="horizontal">
    </LinearLayout>

代码实现:


private LinearLayout mContainer;
   /**
     * 按钮点击事件,向容器中添加TextView
     * @param
     */
    public void addView() {
        TextView child = new TextView(this);
        child.setTextSize(20);
        child.setTextColor(getResources().getColor(R.color.colorAccent));
        // 获取当前的时间并转换为时间戳格式, 并设置给TextView
        child.setText("321");
        // 调用一个参数的addView方法
        mContainer.addView(child);
    }

自定义样式和主题



在工程中res/values/下添加styles.xml


<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="CeShiTheme" parent="AppTheme">
        <item name="android:typeface">monospace</item>
    </style>
    <style name="my_Style">
        <!-- 定义与指定View相关的若干属性 -->
        <item name="android:hint">load from style 1</item>
    </style>
    <!-- 定义my_style_1,没有指定parent,用系统缺省的 -->
    <style name="my_style_1">
        <!-- 定义与指定View相关的若干属性 -->
        <item name="android:hint">load from style 1</item>
    </style>
    <!-- 定义my_style_2,用自定义的my_style_1作为parent -->
    <style name="my_style_2" parent="@style/my_style_1">
        <!-- 定义与指定View相关的若干属性 -->
        <item name="android:textSize">30sp</item>
        <item name="android:textColor">#FFFF0000</item>
        <item name="android:hint">load from style 2</item>
    </style>
    <!-- 定义my_style_3,用android的EditText作为parent -->
    <style name="my_style_3" parent="@android:style/Widget.EditText">
        <!-- 定义与指定View相关的若干属性 -->
        <item name="android:hint">"load from style 3"</item>
        <item name="android:textStyle">bold|italic</item>
        <item name="android:typeface">monospace</item>>
        <item name="android:background">@drawable/logo</item>
    </style>
    <!-- 定义MyTheme,用android的Theme作为parent -->
    <style name="MyTheme" parent="@android:style/Theme">
        <item name="android:textSize">20sp</item>
        <item name="android:textColor">#FF0000FF</item>
        <item name="android:hint">"load from style 3"</item>
        <item name="android:textStyle">bold|italic</item>
        <item name="android:typeface">monospace</item>>
        <item name="android:background">@drawable/logo</item>
    </style>
</resources>



相关文章
|
3月前
|
人工智能 API 云栖大会
Qoder 协作能力升级,「项目」和「讨论」来了
Qoder 推出 Projects 与 Discussion 新功能,解决 AI 时代团队协作痛点:统一任务上下文、支持人与 Agent 共同讨论评审、自动同步执行结果,让协作围绕任务而非工具切换。
473 1
|
3月前
|
JSON 监控 安全
简电云 | OCPP 1.6、OCPP 2.0.1 与 OCPP 2.1 有什么区别?一篇文章讲清协议演进与技术选型
本文从研发与架构视角深度解析OCPP 1.6、2.0.1、2.1三大版本差异,涵盖设备模型、交易状态机、安全体系、智能充电、双向充放电、ISO 15118、支付及换电等核心能力演进,强调版本间非简单兼容,升级需重构数据模型与状态逻辑。
|
9月前
|
中间件 关系型数据库 应用服务中间件
阿里云服务器通用算力型u2a实例cpu型号、性能参数、收费标准与活动价格
阿里云通用算力型u2a实例,基于AMD EPYC™处理器,以其高性价比和稳定性能受中小企业及个人开发者青睐。该实例支持跨平台热迁移,睿频达3.7GHz,采用双单路服务器架构,提升稳定性与可靠性。相比前代,算力提升20%~35%,I/O性能显著增强,且价格降低9%~22%,综合性价比提升超50%。u2a实例提供多种配置与计费模式,新用户享2.5折优惠,且有多种优惠活动,适用于中小型数据库、APP应用服务器等多种场景。
943 1
|
4月前
|
JSON 小程序 API
商品药品条码查询 API 教程:从接入到上线的完整指南
这是一款面向全行业的通用条码查询API,支持商品及药品条码(含UPC、短码等)识别,秒级返回名称、价格、厂商、图片及药品批准文号等权威信息。高稳定(SLA 100%)、低延迟(均值127ms),兼容电商、医药、ERP、小程序等多场景,提供免费试用、批量调用与私有化部署。
744 0
|
8月前
|
移动开发 缓存 前端开发
《小红书商品详情页前端性能优化实战》
《小红书商品详情页前端性能优化实战》聚焦“社区+电商”场景,针对UGC图文视频密集、WebView环境受限、用户路径极短等挑战,通过图片/视频懒加载与格式优化、GraphQL聚合API+App预取、WebView池复用、虚拟列表渲染四大策略,实现FCP↓61%、LCP↓54%、下单转化率↑15%,打造“0白屏、0卡顿、0延迟”的丝滑体验。(239字)
|
11月前
|
弹性计算 人工智能 安全
阿里云服务器:ECS介绍、费用价格、功能优势及使用全解析,2026有问必答FAQ
阿里云ECS是国产份额第一的弹性云服务器,安全可靠、弹性伸缩、按需付费。2026年推经济型e实例(¥99/年起)、通用u1/u2i等新规格,支持免费试用、新老同享优惠,适配建站、AI、游戏等全场景。
831 1
|
人工智能 弹性计算 自然语言处理
1688诚信通AI版七大专属权益全解析,助力商家抢占数字化先机
在深入探讨权益之前,我们首先要理解诚信通AI版的核心价值。它不仅仅是传统诚信通的升级,更是一个集成了人工智能、大数据分析和平台生态资源的智能经营中枢。它通过智能客服、商机预测、运营自动化等能力,极大提升了商家的运营效率和决策精准度。而本次推出的七大权益,正是为了降低商家使用这一先进工具的门槛,并加速其价值释放,实现“开箱即用,用之即效”的良性循环。
2549 14
|
存储 消息中间件 人工智能
【08】AI辅助编程完整的安卓二次商业实战-修改消息聊天框背景色-触发聊天让程序异常终止bug牵涉更多聊天消息发送优化处理-优雅草卓伊凡
【08】AI辅助编程完整的安卓二次商业实战-修改消息聊天框背景色-触发聊天让程序异常终止bug牵涉更多聊天消息发送优化处理-优雅草卓伊凡
919 10
【08】AI辅助编程完整的安卓二次商业实战-修改消息聊天框背景色-触发聊天让程序异常终止bug牵涉更多聊天消息发送优化处理-优雅草卓伊凡
|
存储 算法 定位技术
软考中级软件设计师专项-操作系统篇
专为软考打造的操作系统终极攻略,涵盖进程管理、死锁、存储系统等核心考点,结合20+真题与答题模板,助你高效掌握命题规律,提升应试能力。
797 1
软考中级软件设计师专项-操作系统篇