你的位置:首页 > 软件开发 > 操作系统 > Android二维码之创建

Android二维码之创建

发布时间:2015-05-17 18:01:16
由于微信的推出二维码走进了我们的生活,并且越来越多的人们正在发挥着自己的想象力去使用它,来方便我们的生活,我曾经听说过一个笑话,当我们死后,墓碑上不再有墓志铭,而会出现一个记录你一生信息的二维码,当人们走到你们的墓碑前,掏出手机扫一扫就可以看到你一生的丰功伟绩。这是不是很有意思, ...

Android二维码之创建

  由于微信的推出二维码走进了我们的生活,并且越来越多的人们正在发挥着自己的想象力去使用它,来方便我们的生活,我曾经听说过一个笑话,当我们死后,墓碑上不再有墓志铭,而会出现一个记录你一生信息的二维码,当人们走到你们的墓碑前,掏出手机扫一扫就可以看到你一生的丰功伟绩。这是不是很有意思,我都认这会在不久的将来成为现实,哈哈,玩笑说完了,下面我们来一起学习一下如何Android开发中让二维码为我们服务。

  本篇我将会带领朋友们实现一个记录个人基本信息的二维码设计思路,对于搞过算法的大牛们,这里要让你们失望了,对于二维码生成的算法,本人才疏学浅尚且无法为大家分享,本篇事例的实现我们将借助core.jar实现,对于这个jar包的下载,我为大家提供一个链接,方便大家学习使用:http://pan.baidu.com/s/1bnGZoF9

  准备好我们的jar包后,我们开始今天的设计,第一步:创建工程,导入jar包

  在我们的集成开发环境中,创建一个Android工程项目,为我们今天事例的设计做铺垫。创建好工程后,将我们刚刚下载好的jar包导入到我们的工程中,Ctrl+c我们的jar包,在我们的工程目录下找到libs文件夹Ctrl+v,然后呢?就是通过集成开发环境将我们的jar包导入到工程。

  Android二维码之创建

  第二步:创建我们的布局文件:

<RelativeLayout   ="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:paddingBottom="@dimen/activity_vertical_margin"  android:paddingLeft="@dimen/activity_horizontal_margin"  android:paddingRight="@dimen/activity_horizontal_margin"  android:paddingTop="@dimen/activity_vertical_margin"  tools:context=".MainActivity" > <LinearLayout      android:layout_width="fill_parent"      android:layout_height="wrap_content"      android:orientation="vertical"      android:id="@+id/ll"      >   <!-- 用于展示我们创建的二维码 -->  <ImageView    android:id="@+id/imgCode"    android:layout_width="100dip"    android:layout_height="100dip"    android:layout_gravity="center_horizontal" />            <!-- 公司 -->      <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >        <TextView          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:text="公司" />        <EditText          android:id="@+id/etCompany"          android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:hint="选填" />      </LinearLayout>           <!-- 电话 -->      <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >        <TextView          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:text="电话" />        <EditText          android:id="@+id/etPhone"          android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:hint="选填" />      </LinearLayout>      <!-- 邮箱 -->      <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >        <TextView          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:text="邮箱" />        <EditText          android:id="@+id/etEmail"          android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:hint="选填" />      </LinearLayout>      <!-- 网址 -->      <LinearLayout        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="horizontal" >        <TextView          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:text="网址" />        <EditText          android:id="@+id/etWeb"          android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:text="http://" />      </LinearLayout>                 <Button android:id="@+id/but"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="生成二维码"/>    </LinearLayout></RelativeLayout>

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:Android二维码之创建

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录