首页 > 其他分享 >android生成二维码实例

android生成二维码实例

时间:2024-06-12 13:28:56浏览次数:15  
标签:String int width 二维码 实例 import android com

 android生成二维码实例

生成二维码工具类
package com.catanddog.utils;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.text.TextUtils;

import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.CharacterSetECI;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;

import java.util.Hashtable;

/**
 * @description: 二维码工具类
 * @create: 2024-06-07 7:01
 * @author: lcs
 */
public class QRCodeUtil {

    /**
     * 创建二维码位图
     *
     * @param content 字符串内容(支持中文)
     * @param width 位图宽度(单位:px)
     * @param height 位图高度(单位:px)
     * @return
     */
    @Nullable
    public static Bitmap createQRCodeBitmap(String content, int width, int height){
        return createQRCodeBitmap(content, width, height, "UTF-8", "H", "2", Color.BLACK, Color.WHITE);
    }

    /**
     * 创建二维码位图 (支持自定义配置和自定义样式)
     *
     * @param content 字符串内容
     * @param width 位图宽度,要求>=0(单位:px)
     * @param height 位图高度,要求>=0(单位:px)
     * @param character_set 字符集/字符转码格式 (支持格式:{@link CharacterSetECI })。传null时,zxing源码默认使用 "ISO-8859-1"
     * @param error_correction 容错级别 (支持级别:{@link ErrorCorrectionLevel })。传null时,zxing源码默认使用 "L"
     * @param margin 空白边距 (可修改,要求:整型且>=0), 传null时,zxing源码默认使用"4"。
     * @param color_black 黑色色块的自定义颜色值
     * @param color_white 白色色块的自定义颜色值
     * @return
     */
    @Nullable
    public static Bitmap createQRCodeBitmap(String content, int width, int height,
                                            @Nullable String character_set, @Nullable String error_correction, @Nullable String margin,
                                            @ColorInt int color_black, @ColorInt int color_white){

        /** 1.参数合法性判断 */
        if(TextUtils.isEmpty(content)){ // 字符串内容判空
            return null;
        }

        if(width < 0 || height < 0){ // 宽和高都需要>=0
            return null;
        }

        try {
            /** 2.设置二维码相关配置,生成BitMatrix(位矩阵)对象 */
            Hashtable<EncodeHintType, String> hints = new Hashtable<>();

            if(!TextUtils.isEmpty(character_set)) {
                hints.put(EncodeHintType.CHARACTER_SET, character_set); // 字符转码格式设置
            }

            if(!TextUtils.isEmpty(error_correction)){
                hints.put(EncodeHintType.ERROR_CORRECTION, error_correction); // 容错级别设置
            }

            if(!TextUtils.isEmpty(margin)){
                hints.put(EncodeHintType.MARGIN, margin); // 空白边距设置
            }
            BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);

            /** 3.创建像素数组,并根据BitMatrix(位矩阵)对象为数组元素赋颜色值 */
            int[] pixels = new int[width * height];
            for(int y = 0; y < height; y++){
                for(int x = 0; x < width; x++){
                    if(bitMatrix.get(x, y)){
                        pixels[y * width + x] = color_black; // 黑色色块像素设置
                    } else {
                        pixels[y * width + x] = color_white; // 白色色块像素设置
                    }
                }
            }

            /** 4.创建Bitmap对象,根据像素数组设置Bitmap每个像素点的颜色值,之后返回Bitmap对象 */
            Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
            bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
            return bitmap;
        } catch (WriterException e) {
            e.printStackTrace();
        }

        return null;
    }
}
 绑定点击事件,点击跳转到身份牌列表
        tvIdentity.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                //实名认证
                Intent intent = new Intent(bottomNavigationViewActivity.this, IdentityCardActivity.class);
                startActivity(intent);
            }
        });
 侧拉框的布局
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/background_v_3">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            android:orientation="vertical">
            <FrameLayout
                android:id="@+id/frame_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@id/bottom_navigation" />
            <View
            android:layout_width="match_parent"
            android:layout_height="0.3dp"
            android:layout_above="@id/bottom_navigation"
            android:background="@color/black"/>
            <com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/bottom_navigation"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:background="@drawable/background_bottom"
                app:menu="@menu/menu"
                tools:layout_height="50dp"
                />
        </RelativeLayout>
    </LinearLayout>
    <androidx.drawerlayout.widget.DrawerLayout
        android:id="@+id/drawer_layout2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <LinearLayout
                android:id="@+id/linear_top"
                android:layout_width="match_parent"
                android:layout_height="260dp"
                android:orientation="vertical"
                android:background="@mipmap/background_h_1">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="80dp"
                    android:layout_marginTop="175dp"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:background="@drawable/transparent_rectangle"
                    android:orientation="horizontal">
                    <LinearLayout
                        android:id="@+id/personal_edit"
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="55dp"
                            android:layout_height="50dp"
                            android:layout_gravity="center"
                            android:layout_marginTop="5dp"
                            android:src="@drawable/personal_edit"></ImageView>
                        <TextView
                            android:text="个人信息"
                            android:textColor="@color/white"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:textStyle="bold"
                            android:layout_weight="9"
                            android:layout_height="wrap_content"
                            android:gravity="start"
                            android:textSize="16dp" />
                    </LinearLayout>
                    <LinearLayout
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:id="@+id/personal_like">
                        <ImageView
                            android:layout_marginTop="5dp"
                            android:layout_width="50dp"
                            android:layout_height="50dp"
                            android:layout_gravity="center"
                            android:src="@drawable/personal_like"></ImageView>
                        <TextView

                            android:text="喜欢"
                            android:textColor="@color/white"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:textStyle="bold"
                            android:layout_weight="9"
                            android:layout_height="wrap_content"
                            android:gravity="start"
                            android:textSize="16dp" />
                    </LinearLayout>
                    <LinearLayout
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:id="@+id/personal_collect">
                        <ImageView
                            android:layout_width="55dp"
                            android:layout_height="50dp"
                            android:layout_gravity="center"
                            android:layout_marginTop="5dp"
                            android:src="@drawable/personal_collect02"></ImageView>
                        <TextView
                            android:text="收藏"
                            android:textColor="@color/white"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_weight="9"
                            android:layout_height="wrap_content"
                            android:textStyle="bold"
                            android:gravity="start"
                            android:textSize="16dp" />
                    </LinearLayout>
                    <LinearLayout
                        android:id="@+id/personal_follow"
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="55dp"
                            android:layout_height="50dp"
                            android:layout_marginTop="5dp"
                            android:layout_gravity="center"
                            android:src="@drawable/personal_follow"></ImageView>
                        <TextView
                            android:text="关注"
                            android:textColor="@color/white"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:textStyle="bold"
                            android:layout_weight="9"
                            android:layout_height="wrap_content"
                            android:gravity="start"
                            android:textSize="16dp" />
                    </LinearLayout>

                </LinearLayout>
            </LinearLayout>


            <androidx.cardview.widget.CardView
                android:id="@+id/iv_info_cardview"
                android:layout_width="90dp"
                android:layout_height="90dp"
                android:layout_marginLeft="40dp"
                android:layout_marginTop="60dp"
                app:cardCornerRadius="100sp"
                android:elevation="20dp"
                android:translationZ="20dp"
                android:background="@drawable/avatar_circle_kuang">
                <androidx.cardview.widget.CardView
                    android:id="@+id/iv_mine_cardview"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:layout_centerHorizontal="true"
                    android:elevation="20dp"
                    android:translationZ="20dp"
                    android:layout_gravity="center"
                    app:cardCornerRadius="100sp">
                    <ImageView
                        android:id="@+id/personal_avatar"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:elevation="20dp"
                        android:translationZ="20dp"
                        android:layout_centerHorizontal="true"
                        android:scaleType="centerCrop" />
                    <ProgressBar
                        android:id="@+id/progress_bar"
                        android:layout_width="40dp"
                        android:layout_height="40dp"
                        android:layout_gravity="center"
                        android:visibility="visible" />
                </androidx.cardview.widget.CardView>
            </androidx.cardview.widget.CardView>
            <TextView
                android:id="@+id/personal_nick"
                android:layout_marginTop="70dp"
                android:layout_marginLeft="20dp"
                android:elevation="20dp"
                android:translationZ="20dp"
                android:layout_toRightOf="@+id/iv_info_cardview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="昵称"
                android:textStyle="bold"
                android:textSize="20dp"
                android:textColorHighlight="@color/black"/>
            <TextView
                android:id="@+id/personal_signature"
                android:layout_below="@+id/personal_nick"
                android:layout_toRightOf="@+id/iv_info_cardview"
                android:layout_marginLeft="20dp"
                android:elevation="20dp"
                android:translationZ="20dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:text="个性签名"
                android:textSize="16dp"
                />

            <LinearLayout
                android:id="@+id/linear_bottom"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/linear_top"
                android:layout_marginTop="-2dp"
                android:background="@mipmap/background_many_cat03"
                android:orientation="vertical">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="20dp"
                    android:background="@color/gray">
                </LinearLayout>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_gravity="center"
                    android:background="@android:color/darker_gray" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:layout_marginBottom="15dp"
                    android:orientation="horizontal">
                    <TextView
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="20dp"
                        android:layout_marginLeft="10dp"
                        android:textSize="16dp"
                        android:text="收货地址"
                        />
                    <TextView
                        android:layout_weight="6"
                        android:layout_width="wrap_content"
                        android:id="@+id/personal_address"
                        android:layout_height="20dp"
                        android:textSize="16dp"
                        android:text="未设置收货地址"
                        android:textColor="@color/black"
                        />
                </LinearLayout>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_gravity="center"
                    android:background="@android:color/darker_gray" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:layout_marginBottom="15dp"
                    android:orientation="horizontal">
                    <TextView
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="20dp"
                        android:layout_marginLeft="10dp"
                        android:textSize="16dp"
                        android:text="手机号"
                        />
                    <TextView
                        android:layout_weight="6"
                        android:id="@+id/personal_phone"
                        android:layout_width="wrap_content"
                        android:layout_height="20dp"
                        android:textSize="16dp"
                        android:textColor="@color/black"/>
                </LinearLayout>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_gravity="center"
                    android:background="@android:color/darker_gray" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:layout_marginBottom="15dp"
                    android:orientation="horizontal">
                    <TextView
                        android:id="@+id/personal_pet_id"
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="20dp"
                        android:layout_marginLeft="10dp"
                        android:textSize="16dp"
                        android:text="宠物身份牌"
                        />
                </LinearLayout>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_gravity="center"
                    android:background="@android:color/darker_gray" />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="30dp"
                    android:id="@+id/personal_order"
                    android:text="订单"
                    android:textSize="16dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginLeft="10dp"/>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_gravity="center"
                    android:background="@android:color/darker_gray" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:layout_marginBottom="15dp"
                    android:orientation="horizontal">
                    <TextView
                        android:layout_weight="1"
                        android:layout_width="wrap_content"
                        android:layout_height="20dp"
                        android:layout_marginLeft="10dp"
                        android:textSize="16dp"
                        android:text="个人宠物"
                        />
                    <TextView
                        android:layout_weight="6"
                        android:id="@+id/personal_pet"
                        android:layout_width="wrap_content"
                        android:layout_height="20dp"
                        android:textSize="16dp"
                        android:text="点此添加个人宠物"
                        android:textColor="@color/black"/>
                </LinearLayout>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_gravity="center"
                    android:background="@android:color/darker_gray" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">
                    <TextView
                        android:layout_weight="1"
                        android:id="@+id/personal_finish1"
                        android:layout_width="wrap_content"
                        android:layout_height="50dp"
                        android:gravity="center"
                        android:textColor="@color/black"
                        android:text="退出应用"
                        />
                    <View
                        android:layout_width="3dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="center"
                        android:background="@android:color/darker_gray" />
                    <TextView
                        android:layout_weight="1"
                        android:id="@+id/personal_exchange1"
                        android:layout_width="wrap_content"
                        android:layout_height="50dp"
                        android:gravity="center"
                        android:textColor="@color/black"
                        android:text="切换账号"
                        />
                </LinearLayout>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_gravity="center"
                    android:background="@android:color/darker_gray" />
            </LinearLayout>
        </RelativeLayout>
    </androidx.drawerlayout.widget.DrawerLayout>
</androidx.drawerlayout.widget.DrawerLayout>

 

 activity
package com.catanddog.Personal.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;

import com.catanddog.Personal.adapter.IdentityAdapter;
import com.catanddog.Personal.entity.Item;
import com.catanddog.R;

import java.util.ArrayList;
import java.util.List;

public class IdentityCardActivity extends AppCompatActivity {
    private ImageView imageView;
    private ListView listView;
    @Override
    @SuppressLint("MissingInflatedId")
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_identity_card);

        // 初始化控件
        initViews();

        // 给listView设置数据
        List<Item> dataList = new ArrayList<>();
        dataList.add(new Item("Title 1", R.drawable.default_avatar));
        dataList.add(new Item("Title 2", R.drawable.default_avatar));

        IdentityAdapter myAdapter = new IdentityAdapter(dataList);
        listView.setAdapter(myAdapter);

        // 设置点击事件
        listView.setOnItemClickListener((parent, view, position, id) -> {
            // 处理点击事件
            Item item = dataList.get(position);
            System.out.println("点击了第" + (position + 1) + "个item,标题是:" + item.getTitle());
            // 跳转到生成的二维码页
            Intent intent = new Intent(this, QRCodeActivity.class);
            intent.putExtra("name", "小米");
            intent.putExtra("sex", "男");
            intent.putExtra("age", "8");
            intent.putExtra("address", "北京");
            intent.putExtra("phone", "173349876641");
            intent.putExtra("email", "[email protected]");
            intent.putExtra("idcard", "123456789");
            intent.putExtra("image", "http://10.6.207.113:8080/catanddog/upload/lcs1.jpg");
            startActivity(intent);
        });
    }

    private void initViews() {
//        imageView = findViewById(R.id.imageView_ercode);
        listView = findViewById(R.id.listView_identitycard);
    }
}
<?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=".Personal.activity.IdentityCardActivity">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/listView_identitycard" />

</LinearLayout>
 adapter
package com.catanddog.Personal.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.catanddog.Personal.entity.Item;
import com.catanddog.R;

import java.util.List;

public class IdentityAdapter extends BaseAdapter {

    private List<Item> mData; // 数据源

    public IdentityAdapter(List<Item> data) {
        mData = data;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int position) {
        return mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.identity_item_layout, parent, false);
        }

        ImageView imageView = convertView.findViewById(R.id.image_view);
        imageView.setImageResource(mData.get(position).getImageResource());

        TextView textView = convertView.findViewById(R.id.text_view);
        textView.setText(mData.get(position).getTitle());

        return convertView;
    }
}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <ImageView
        android:id="@+id/image_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/default_avatar"/>

    <TextView
        android:id="@+id/text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@android:color/black"/>

</LinearLayout>

 

 生成二维码的activity
package com.catanddog.Personal.activity;

import android.os.Bundle;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

import com.catanddog.R;
import com.catanddog.utils.QRCodeUtil;

public class QRCodeActivity extends AppCompatActivity {
    private ImageView qrcode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qrcode);
        // 初始化控件
        initViews();

        // 接受输入的二维码信息
        String name = getIntent().getStringExtra("name");
        String sex = getIntent().getStringExtra("sex");
        String address = getIntent().getStringExtra("address");
        String age = getIntent().getStringExtra("age");
        String phone = getIntent().getStringExtra("phone");
        String email = getIntent().getStringExtra("email");
        String idcard = getIntent().getStringExtra("idcard");
        String image = getIntent().getStringExtra("image");
        // 拼接二维码信息,拼接后格式加上换行符
        String qrcodeInfo = name + "\n" + sex + "\n" + address + "\n" + age + "\n" +phone ;

        // 生成二维码
        qrcode.setImageBitmap(QRCodeUtil.createQRCodeBitmap(qrcodeInfo, 200, 200));
    }

    private void initViews() {
        qrcode = (ImageView) findViewById(R.id.qrcode_image);
    }
}
<?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=".Personal.activity.QRCodeActivity">

    <ImageView
        android:id="@+id/qrcode_image"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY" />

</LinearLayout>

 

标签:String,int,width,二维码,实例,import,android,com
From: https://blog.csdn.net/LIUCHANGSHUO/article/details/139623814

相关文章

  • 03《android studio开发实战(第三版)》阅读笔记
    第四章:用户界面开发 本章介绍了Android中的常见布局管理器,如LinearLayout、RelativeLayout和ConstraintLayout,以及它们的使用场景和特点。 学习了各种用户界面元素,如TextView、EditText、Button等的使用方法,以及如何将它们组合在一起创建复杂的用户界面。理解了Android中的资源......
  • excel中加水印以及二维码
    1.如何给excel添加二维码其实二维码就是一张图片,把生成的二维码作为图片返回给excel对应的栏位就可以达到目的,代码如下:点击查看代码publicBitmapGetBitmap(stringcode,ExcelPackagepackage){varsheet=package.Workbook.Worksheets[0];//创建QR码生成器......
  • DophinScheduler 如何定期删除日志实例?
    转载自东华果汁哥ApacheDophinScheduler运行一段时间后,实例调度日志越来越多,需要定期清理。SQL错误[1701][42000]:Cannottruncateatablereferencedinaforeignkeyconstraint(`dolphinscheduler`.`t_ds_task_instance`,CONSTRAINT`foreign_key_instance_id`)......
  • Android 12.0 展讯平台关机充电动画横屏显示修改
    1.前言在12.0的系统rom定制化开发中,在关于展讯平台的产品中,系统默认的充电动画是竖屏显示的,但是在像平板的产品中竖屏动画肯定不符合规范,所以需要在平板TV产品中,充电动画同时也是需要修改为横屏显示的,接下来就来分析下充电动画的相关绘制流程,然后实现功能2.展讯平台关机充电......
  • Android Media Framework(五)Tunnel Mode
    本篇将聚焦AndroidTunnelMode,详细解析组件之间隧道连接过程、数据传递过程、组件销毁过程。通过阅读本篇内容,我们应能对tunneled组件的连接过程和buffer分配过程有所了解。1、TunnelMode介绍ILSpec详细描述了TunnelComponent的实现方式,但内容较为晦涩难懂,网上相关的资料......
  • TensorFlow、Keras的LSTM神经网络预测和异常检验股市价格时间序列数据可视化python实
    全文链接:https://tecdat.cn/?p=36448原文出处:拓端数据部落公众号本文旨在探讨如何利用TensorFlow和Keras中的LSTM神经网络来预测和检验股市价格时间序列数据,并通过Python编程语言和可视化技术来展示预测结果和异常检验的效果。具体而言,本文将首先介绍LSTM神经网络的基本原理和Te......
  • 【练习代码】6.11 java学习记录:继承与多态(实例:媒体资料库的设计)
    设计一个媒体资料库,能存入不同类别的媒体资料,例如CD与DVD,并且能完成添加与列表等操作,需要些什么?最基础的想法一个代表整体库的DataBase类,内部的属性包括CD和DVD的Arraylist,对应操作通过定义自己的方法来实现,部分代码如下:publicclassDatabase{privateArrayList<CD>......
  • 安卓应用开发——Android Studio中滚动布局的应用
    一、前情提要 现如今,许多软件的主界面都采用了滚动条的功能,以展示软件中长条的商品又或是广告,经典的社交软件与购物软件等软件都不可避免的需要实现这一功能,今天我们来简单学习在AndroidStudio中实现一个属于自己的滚动布局页面。二、简单思路 本次功能设计需要一个页面......
  • 学会python——文本分词(python实例一)
    目录1、认识Python2、环境与工具2.1python环境2.2pycharm编译3、对文本进行分词3.1代码构思3.2代码示例3.3运行结果4、总结1、认识PythonPython是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。Python的设计具有很强的可读性,相比其他......
  • Android14之向build.prop添加属性(二百一十九)
    简介:CSDN博客专家,专注Android/Linux系统,分享多mic语音方案、音视频、编解码等技术,与大家一起成长!优质专栏:Audio工程师进阶系列【原创干货持续更新中……】......