码迷,mamicode.com
首页 > 移动开发 > 详细

Android 扫描枪开发(一)

时间:2018-12-20 14:32:15      阅读:437      评论:0      收藏:0      [点我收藏+]

标签:pen   rect   pil   button   rap   ext   1.0   rectangle   execution   

最近公司需要,准备开发扫描枪。

话不多说,直接开始

 

一,创建新项目

1 如果遇到

Error:Execution failed for task ‘:app:preDebugAndroidTestBuild‘.
> Conflict with dependency ‘com.android.support:support-annotations‘ in project ‘:app‘. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

参见:https://www.cnblogs.com/hanjun0612/p/10141393.html

 

2 使用更加美观的android material design

在build.gradle中,增加如下

dependencies {
    compile ‘com.github.navasmdc:MaterialDesign:1.5@aar‘
}

如果遇到错误:

技术分享图片

 注释build.gradle中的design

dependencies {
//    implementation ‘com.android.support:design:26.1.0‘

    compile ‘com.github.navasmdc:MaterialDesign:1.5@aar‘
}

 

3 在res/layout/activity_main.xml中添加如下代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="com.example.tyler.scangun_kps.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!111"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <com.gc.materialdesign.views.ButtonRectangle
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#1E88E5"
        android:text="Button" />

</android.support.constraint.ConstraintLayout>

4 显示效果

技术分享图片

 

android material design帮助:https://android-arsenal.com/details/1/1156

Android 扫描枪开发(一)

标签:pen   rect   pil   button   rap   ext   1.0   rectangle   execution   

原文地址:https://www.cnblogs.com/hanjun0612/p/10148446.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!