记录Google 开源库 zxing生成 二维码 读取二维码的基本使用

记录Google 开源库 zxing 使用

xml文件代码
/**
这里放了一个imageview 和一个 TextView
  imageview  用来显示二维码的图片
  TextView   显示二维码里面的内容
*/

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
>

    <TextView
        android:id="@+id/content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:textColor="#000"
        android:layout_centerHorizontal="true"
        android:layout_above="@+id/iv"
        />
    <ImageView
        android:id="@+id/iv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"/>
</RelativeLayout>
public  class MainActivity extends AppCompatActivity implements View.OnClickListener,View.OnLongClickListener{
   

/**
 * 记录关于Google zxing库一些基本用法
 * 1.生成二维码
 * 2.显示二维码的内容文本
 * */
    /**
     * @param iv 显示二维码图片
     * @param content_text 显示二维码里面的内容文本
     * @param content 二维码里面的内容
     * @param bitmap 位图
     * @param bitMatrix BitMatrix是Zxing库定义的一个二维码的数据类
     * @param matrix 放大缩小矩阵
     * @param QRCode_Width  二维码的宽度
     * @param QRCode_Height 二维码的高度
     * @param hashtable 二维码的配置参数
     * @param qrCodeWriter 二维码流
     * @param Pixel 填充像素的一维数组
     * @param IMAGE_Status 判断当前图片的状态 false原始大小  true 放大
     * */
    private ImageView iv;
    private TextView content_text;
    private static final String TAG = "MainActivity";
    public String content;
    public Bitmap bitmap;
    public Bitmap Scale_bitmap;
    public BitMatrix bitMatrix;
    public Matrix matrix=new Matrix();
    public int QRCode_Width=300;
    public int QRCode_Height=300;
    
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值