美文网首页
Android 杂记

Android 杂记

作者: Android开发小白 | 来源:发表于2018-06-11 09:50 被阅读0次

    1.TypedValue 用于转换标准尺寸

    /**
    *第一个参数 单位
    *第二个参数 大小
    *第三个参数固定值
    *例子含义:讲12dp安装标准转换为px
    **/
      TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,12f,getResources().getDisplayMetrics());
    
    

    2.依赖本地aar
    Gradle中

    repositories {
        flatDir {
            dirs 'libs'//本地aar的目录 需要在同级下创建该目录
        }
    }
    
    implementation(name: 'page-index-SNAPSHOT', ext: 'aar')
    

    3.本地Maven仓库

    // 发布到本地库 ----begin-----------------------------------------
    apply plugin: 'maven'
    uploadArchives{
        repositories {
            mavenDeployer {
                repository(url: uri('file://C:/Users/wb-zxq412979/.m2/repository'))
                pom.groupId = "demo"
                pom.artifactId = "index"
                pom.version = "1.0.1-SNAPSHOT"
                pom.packaging="aar"
            }
        }
    }
    // 发布到本地库 ---- end -----------------------------------------
    

    4.Gradle依赖项之transitive/exclude/force/(+)

    传递(transitive)
    排除(exclude)
    强制(force)
    动态版本(+)

    implementation('com.xxx:xxx:1.0.0@aar') {
            transitive = true
            changing = true
            force = true
            exclude group: 'com.xxx', module: 'xxx'
        }
    
    20180517214257444.png

    相关文章

      网友评论

          本文标题:Android 杂记

          本文链接:https://www.haomeiwen.com/subject/yuuceftx.html