二维码,条形码现在大街小巷都有。以防哪天有需要,所以先学习一下。在Android平台上主流还是用zxing库,因此这里主要讲述如何利用zxing进行二维码开发。
我是在网上找到的案例,把它调通修改了一下。
1、首先,它需要两个JAR包core-3.1.0.jar javase-3.1.0.jar,把jar包先导入到程序。
2、activity_main.xml布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/Edit_string"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp" />
<Button
android:id="@+id/btn_handle_decode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/handle_decode" />
<Button
android:id="@+id/btn_create_decode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@s