震惊!如此多的 Android 开发技巧!

fff444dd22 7年前
   <p>一些很不错的Android开发技巧,这个项目翻译自 <a href="/misc/goto?guid=4959741479427954412" rel="nofollow,noindex">android-tips-tricks</a> 去掉了一些我认为不重要的,对我使用过的东东做了评价,同时翻译了一些自己没有注意到的知识点的文章。</p>    <h3>:heart: star 支持一下</h3>    <p>了解你的工具</p>    <p><em>Android Studio</em></p>    <ul>     <li> <p>使用快捷键</p> <p>完整的快捷键指南 : <a href="/misc/goto?guid=4959741479523871504" rel="nofollow,noindex">MacOSX</a> | <a href="/misc/goto?guid=4959741479603182172" rel="nofollow,noindex">Linux/Win</a></p> </li>     <li> <p>使用更有效率的插件</p>      <ol>       <li> <p><a href="/misc/goto?guid=4959733148076606589" rel="nofollow,noindex">KeyPromoter</a></p> <p>快捷键提示插件 -- 试用了一下,就是你点击的时候有些按钮会出来提示框告诉你这个的快捷键是什么以及你使用的次数,还不错,目的就是让你进行键盘流操作。</p> </li>       <li> <p><a href="/misc/goto?guid=4959733148171311571" rel="nofollow,noindex">String Manipulation</a></p> <p>提供 Action 转换大小写什么的,感觉想不起来用。</p> </li>       <li> <p><a href="/misc/goto?guid=4959741479752077739" rel="nofollow,noindex">Lines Sorter</a></p> <p>Add Sort Lines action in Edit menu to sort selected lines or whole file if selection is empty.</p> </li>       <li> <p><a href="/misc/goto?guid=4958977824108916819" rel="nofollow,noindex">Findbugs</a></p> <p>静态代码审查工具</p> </li>       <li> <p><a href="/misc/goto?guid=4959741479861912843" rel="nofollow,noindex">Sonar Lint</a></p> <p>也是个代码审查工具,检查可能出现的bug</p> </li>       <li> <p><a href="/misc/goto?guid=4959741479930603214" rel="nofollow,noindex">Checkstyles</a></p> <p>代码风格管理的插件</p> </li>       <li> <p><a href="/misc/goto?guid=4959741480044769790" rel="nofollow,noindex">ADB Idea</a></p> <p>增加了例如卸载,重启App的功能</p> </li>       <li> <p><a href="/misc/goto?guid=4959741480119519947" rel="nofollow,noindex">Exynap</a></p> <p>这个玩意挺NB的输入个大概就能帮你写代码。其中的bind view 挺好用的。</p> </li>       <li> <p><a href="/misc/goto?guid=4959554913276187053" rel="nofollow,noindex">Dagger IntelliJ Plugin</a></p> <p>Dagger的可视化辅助工具</p> </li>       <li> <p><a href="/misc/goto?guid=4959736015774182219" rel="nofollow,noindex">JVM Debugger Memory View</a></p> <p>可以调试JVM的一些细节,讲真我用的不多</p> </li>      </ol> </li>     <li> <p>在 Android Studio 中使用 Live Templateso</p>      <ul>       <li>newInstance - 在Fragment中生成 newInstance 方法</li>       <li>Toast - 生成 Toast.makeText(context, "", Toast.LENGTH_SHORT).show();</li>       <li>fbc - 生成 findViewById</li>       <li>const - 定义一个 android style int 常量</li>       <li>logd - 生成 Log.d(TAG, "");</li>       <li>logm - Log 当前方法名称和参数</li>       <li>logr - Log 当前方法结果</li>       <li>logt - 当前类生成 log tag</li>       <li>psf - public static final</li>       <li>sout - 打印一个字符串到 System.out</li>       <li>soutm - 打印当前类名和方法到 System.out</li>       <li>soutp - 打印方法参数和返回值到 System.out</li>       <li>visible - 设置 view VISIBLE</li>       <li>gone - 设置 view GONE</li>       <li>noInstance - private 构造方法</li>      </ul> <p><a href="/misc/goto?guid=4958877135729962837" rel="nofollow,noindex">Comprehensive list of all Live Templates in Android Studio</a> 这个库有很多的自定义模版</p> </li>     <li> <p>Android Studio 的自动完成</p> <p>Android Studio/IntelliJ 可以帮你自动完成一些代码</p>      <ul>       <li><expr>.null 转换成 if(<expr> == null)</li>       <li><expr>.nootnull 转换成 if(<expr> != null)</li>       <li><expr>.var 转换成 T name = <expr></li>       <li><expr>.field 会自动生成一个全局变量 field = <expr></li>       <li><ArrayExpr>.for 转换成 for(T item : <Arrayexpr>)</li>       <li><ArrayExpr>.fori 转换成 for(int i = 0; i < <Arrayexpr>.length; i++)</li>       <li><ArrayExpr>.forr 转换成 for(int i = <Arrayexpr>.length - 1; i > 0 ; i--)</li>      </ul> <p>完整的转换列表参见 <strong>Settings → Editor → Postfix Templates</strong></p> </li>     <li> <p>使用黑色主题</p> <p>虽然是个人爱好,反正我觉得使用白色主题好瞎眼啊</p> </li>     <li> <p>别使用小字体</p> <p>给你的 Android Studio 选择一个合适的字体,作者推荐使用 <a href="/misc/goto?guid=4959741480283878072" rel="nofollow,noindex">Menlo font</a> 反正我觉得mac的字体就挺好的,在linux上开发已经觉得不顺眼了.</p> </li>     <li> <p>使用一个 code style</p> <p>你应该使用一个标准的编码风格,它可以是:</p>      <ul>       <li><a href="/misc/goto?guid=4959722584936538654" rel="nofollow,noindex">AOSP Codestyle</a></li>       <li><a href="/misc/goto?guid=4959726474655066705" rel="nofollow,noindex">Square IntelliJ Codestyle</a></li>      </ul> <p>表示在编码风格这一块自己确实有待规范^^</p> </li>     <li> <p>使用 <a href="/misc/goto?guid=4959741480432411551" rel="nofollow,noindex">Embedded Terminal inside Android Studio</a></p> </li>     <li> <p>使用 Memory/Network/CPU Monitor 检测你的 code/app</p> </li>     <li> <p><a href="/misc/goto?guid=4959741480513530124" rel="nofollow,noindex">配置 Android Studio</a></p> <p>这个可以看下,文章提到的我是早就配置过了</p> </li>    </ul>    <p><em>模拟器</em></p>    <ul>     <li><a href="/misc/goto?guid=4958968975981073888" rel="nofollow,noindex">Genymotion</a> 曾经我最喜欢的模拟器,貌似收费了,现在x86的模拟器也挺快的了。</li>     <li><a href="/misc/goto?guid=4959741480622557383" rel="nofollow,noindex">Intel Emulator bundled in SDK Manger</a></li>    </ul>    <p><em><a href="/misc/goto?guid=4959741480695442607" rel="nofollow,noindex">Vysor</a> </em></p>    <p>简单说就是显示你连上的真机,也就在你做演示的时候有些用处,而且我一连上手机就自己跳出来,各位自己使用评价吧!</p>    <p><em><a href="/misc/goto?guid=4959741480779364952" rel="nofollow,noindex">DeskDock</a> </em></p>    <p>不但能展示还可以控制你的Android设备. <a href="/misc/goto?guid=4959741480779364952" rel="nofollow,noindex">免费版本</a> 可以使用电脑鼠标, <a href="/misc/goto?guid=4959741480874444942" rel="nofollow,noindex">收费版本</a> 可以使用电脑键盘. 你可以手不离开键盘进行测试.</p>    <p>-</p>    <h3><em>编码时候的更优选择</em></h3>    <ul>     <li> <p>使用 OkHttp 替代 HttpUrlConnect</p> <p>HttpUrlConnect 有一些bug <a href="/misc/goto?guid=4959741480957959993" rel="nofollow,noindex">quite some bugs</a> . <a href="/misc/goto?guid=4959639840128934398" rel="nofollow,noindex">Okhttp</a> 优雅的解决了他们. <a href="/misc/goto?guid=4959741481067785889" rel="nofollow,noindex">[Reference Link]</a></p> </li>     <li> <p>按照如下方式使用本地 aar [ <a href="/misc/goto?guid=4959741481153561132" rel="nofollow,noindex">Stackoverflow Ref</a> ]</p> <pre>  <code class="language-java">dependencies {           compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar')         }        repositories{              flatDir{                      dirs 'libs'               }         }</code></pre> </li>     <li> <p>使用 <a href="/misc/goto?guid=4959550704924680482" rel="nofollow,noindex">Pidcat</a> 获得更好的阅读体验</p> <p>这个不错,不过我没找到一个命令参数表,就只关注我想要关注的 log</p> </li>     <li> <p>使用版本控制系统(VCS) 例如 <a href="/misc/goto?guid=4958964328408675079" rel="nofollow,noindex">Git</a></p> </li>     <li> <p>使用 <a href="/misc/goto?guid=4958973896930631261" rel="nofollow,noindex">ClassyShark</a></p> <p>可以分析Android Apk很不错</p> </li>     <li> <p>使用 <a href="/misc/goto?guid=4958866107400682143" rel="nofollow,noindex">Stetho</a></p> <p>非死book 出品,非常不错的工具,可以在 Chrome 中看到网络请求,调试数据库和SharePreference,和 Okhttp搭配使用更好,我配合urlconnection使用不生效,原因不明。</p> </li>     <li> <p>使用 <a href="/misc/goto?guid=4958860265658930737" rel="nofollow,noindex">Battery Historian</a></p> <p>使用"bugreport"分析耗电</p> </li>     <li> <p>总是使用固定的版本号 例如 "24.2.0"</p> <p>版本依赖时候避免使用 +</p>      <ul>       <li>防止api变更.</li>       <li>编译的时候不会请求网络检查版本.</li>      </ul> </li>     <li> <p>使用 <a href="/misc/goto?guid=4959741481369329447" rel="nofollow,noindex">Handler 替代 TimerTask</a></p> <p>这篇文章可以看一下,作者说在一些设备上 Timer 不工作但是原因不明,作者说的使用 Handler 替代 Timer 确实是对的,我们商店有一段时间anr很多,后来发现和Timer相关。</p> </li>     <li> <p><a href="/misc/goto?guid=4959665558092007438" rel="nofollow,noindex">Google Play 的开发者账户不要使用你的个人邮箱</a></p> </li>     <li> <p>使用 Vectors 替代 PNG</p> <p>如果你 <strong>确实</strong> 要用png, 可以使用 <a href="/misc/goto?guid=4959655615562598232" rel="nofollow,noindex">TinyPNG</a> 压缩.</p> </li>     <li> <p>使用 proguard</p> <pre>  <code class="language-java">android {        ...        buildTypes {            release {                minifyEnabled true                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'            }        }    }</code></pre> </li>     <li> <p>使用 shrinkResources</p> <pre>  <code class="language-java">android {        ...        buildTypes {            release {                shrinkResources true                minifyEnabled true                ...            }        }      }</code></pre> <p>shrinkResources 是把你没用到的文件用一个很小的文件替换,我觉得要是你发现了那个文件确实没啥用,你还是删除了吧。</p> </li>     <li> <p><a href="/misc/goto?guid=4959741481512951062" rel="nofollow,noindex">模拟 app 在后台被杀死</a> , 在终端运行</p> <p>adb shell am kill</p> </li>     <li> <p>参考 <a href="/misc/goto?guid=4959741481591043781" rel="nofollow,noindex">降低 gradel 内存又加快构建</a></p> <p>译文见 <a href="/misc/goto?guid=4959741481674138206" rel="nofollow,noindex">降低 gradel 内存又加快构建</a></p> <pre>  <code class="language-java">Gradle memory >= Dex memory + 1Gb</code></pre> </li>     <li> <p>使用 ndk 的时候注意自己分割 abi</p> <pre>  <code class="language-java">defaultConfig {          ...            ndk {            abiFilters "armeabi", "armeabi-v7a", "mips", "x86"          }        }        //Split into platform dependent APK        splits {          abi {            enable true            reset()            include 'armeabi', 'armeabi-v7a', 'mips', 'x86' //select ABIs to build APKs for            universalApk false //generate an additional APK that contains all the ABIs          }        }          // map for the version code        project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'mips': 5, 'x86': 8]          // Rename with proper versioning        android.applicationVariants.all { variant ->          // assign different version code for each output          variant.outputs.each { output ->            output.versionCodeOverride =                project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) *                    1000000 +                    android.defaultConfig.versionCode          }        }</code></pre> </li>     <li> <p>学习一些架构例如 MVP 或者 Clean架构</p> </li>     <li> <p>尝试理解 TDD (测试驱动开发)</p> </li>     <li> <p>强制重新下载 dependencies</p> <pre>  <code class="language-java">./gradlew --refresh-dependencies</code></pre> </li>     <li> <p>gradle 中跳过某个task</p> <p>下面的例子是跳过 javaDoc 这个任务</p> <pre>  <code class="language-java">./gradlew clean build -x javaDoc</code></pre> </li>     <li> <p>为每个子项目的脚本配置同名 gradle 构建文件</p> <p>settings.gradle 中设置</p> <pre>  <code class="language-java">rootProject.children.each{      it.buildFileName = it.name + '.gradle'    }</code></pre> <p><a href="/misc/goto?guid=4959741481750905359" rel="nofollow,noindex">更多的Gradle技巧</a></p> </li>     <li> <p>记住 DRY</p> <p>DRY = Do not Repeat Yourself</p> </li>     <li> <p><a href="/misc/goto?guid=4959665557667282244" rel="nofollow,noindex">按照功能分包</a></p> <p>一开始我们也是按照层去分包的,很坑爹。按照功能分可能你不是很好区分在哪个功能中,不过也比你按照层区分要好找很多。</p> </li>     <li> <p><a href="/misc/goto?guid=4959741481864625997" rel="nofollow,noindex">学习依赖原理</a></p> <p>有利于你学习解决一些依赖冲突. <a href="/misc/goto?guid=4959741481939735464" rel="nofollow,noindex">官方参考</a></p> </li>     <li> <p>给你没发布的版本使用不同包名</p> <pre>  <code class="language-java">android {            buildTypes {                debug {                    applicationIdSuffix '.debug'                    versionNameSuffix '-DEBUG'                }                  release {                    // ...                }            }        }</code></pre> </li>     <li> <p><a href="/misc/goto?guid=4959716195404629012" rel="nofollow,noindex">找出并解决你的内存泄露</a></p> </li>     <li> <p><a href="/misc/goto?guid=4959741482054648712" rel="nofollow,noindex">小心使用 @android:color/transparent </a></p> </li>     <li> <p><a href="/misc/goto?guid=4959741482130366396" rel="nofollow,noindex">遵循标准的资源命名</a></p> </li>     <li> <p>build.gradle 中使用自定义任务</p> <p>Android使用Gradle构建,这实际上可以很容易做些自动化的东西。 <a href="/misc/goto?guid=4959741482217585610" rel="nofollow,noindex">实用的 Gradle 脚本</a></p> </li>     <li> <p>给你的Android项目使用合适的 .gitignore, <a href="/misc/goto?guid=4959741482287725928" rel="nofollow,noindex">Check it here</a></p> </li>     <li> <p><a href="/misc/goto?guid=4958874766191309432" rel="nofollow,noindex">使用 LeakCanary 分析你的app</a></p> </li>     <li> <p>使用 Android Studio 2.3 加速 gradle 构建+</p>      <ul>       <li> <p>切换到 gradle 3.3</p> <p>执行下面的代码升级你的 gradle wrapper</p> <pre>  <code class="language-java">./gradlew wrapper --gradle-version 3.3 --distribution-type all</code></pre> </li>       <li> <p>全局 gradle.properties 如下设置</p> <pre>  <code class="language-java">android.enableBuildCache=true  </code></pre> </li>      </ul> <p>这个命令我测试了,不好使啊!直接改wrapper里面引用就行。</p> </li>     <li> <p>停止 gradle 构建进程</p> <pre>  <code class="language-java">./gradlew -stop</code></pre> </li>     <li> <p>开启 gradle 自动下载sdk</p> <p>全局 gradle.properties 如下设置</p> <pre>  <code class="language-java">  android.builder.sdkDownload=true  </code></pre> <p>实验性功能</p> </li>     <li> <p>jcenter() 和 mavenCentral() 不用同时依赖`</p> <p>JCenter 是 MavenCentral 的超集. </p> </li>     <li> <p>这样清除 gradle 缓存</p>      <ul>       <li>~/.gradle/caches/ 删除 cache 文件夹</li>       <li>打开 SDK Manager 重新同步 support libs 和 google play services</li>       <li>re-sync project</li>       <li>搞定</li>      </ul> </li>     <li> <p>给你的 adb 设置别名</p> <p>以下的 <strong>Aliases</strong> 可以被添加到 ~/.bashrc 或者 ~/.zshrc ,看起来不错</p> </li>    </ul>    <table>     <thead>      <tr>       <th>Alias</th>       <th>Usage</th>      </tr>     </thead>     <tbody>      <tr>       <td>alias screenshot="adb exec-out screencap -p > screen-$(date -j "+%s").png"</td>       <td>screenshot</td>      </tr>      <tr>       <td>alias startintent="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X shell am start $1"</td>       <td>startintent https://推ter.com/nisrulz</td>      </tr>      <tr>       <td>alias apkinstall="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X install -r $1"</td>       <td>apkinstall ~/Desktop/DemoApp.apk</td>      </tr>      <tr>       <td>alias rmapp="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X uninstall $1"</td>       <td>rmapp com.example.demoapp</td>      </tr>      <tr>       <td>alias clearapp="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X shell pm clear $1"</td>       <td>clearapp com.example.demoapp</td>      </tr>     </tbody>    </table>    <ul>     <li> <p>设置含有 //STOPSHIP 时候编译失败 </p> <p>启用这个功能 //STOPSHIP 失败功能, build.gradle 如下设置</p> <pre>  <code class="language-java">android {    ...        lintOptions {            abortOnError true            fatal 'StopShip'        }    }</code></pre> <p>//STOPSHIP 注释也会导致编译失败。</p> <p>在 Android Studio Preferences > Editor > Code Style > Inspections , 可以控制这个功能</p> </li>     <li> <p>使用 adb install -g 安装并授予manifest中的全部权限</p> </li>     <li> <p>使用 <a href="/misc/goto?guid=4958961794120015128" rel="nofollow,noindex"> alfi </a> 查找一个库的依赖</p> <p><a href="/misc/goto?guid=4959741482833287044" rel="nofollow,noindex">Gradle, Please</a> 的命令行版本.</p> </li>    </ul>    <pre>  <code class="language-java">+ 执行        ```bash      alfi name_of_library      ```    + 复制结果  + 粘贴到 build.gradle  </code></pre>    <ul>     <li> <p>使用 <a href="/misc/goto?guid=4958966068485916030" rel="nofollow,noindex"> dryrun </a> 直接测试一个库</p>      <ul>       <li>运行</li>      </ul> <pre>  <code class="language-java">dryrun REMOTE_GIT_URL</code></pre> <p>表示还得下各种gradle版本,也就那么回事,不见得多快。</p> </li>     <li> <p>控制台直接输入单元测试结果</p> <p>控制台输出单元测试结果小技巧.</p> <pre>  <code class="language-java">android {        ...        testOptions.unitTests.all {          testLogging {            events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'            outputs.upToDateWhen { false }            showStandardStreams = true          }        }      }</code></pre> </li>     <li> <p>离线模式编译更快</p> <p>--offline 总是从cache运行, 离线模式不会访问网络.没有缓存会编译失败.</p>      <ul>       <li> <p>给你的Debug加速:</p> <pre>  <code class="language-java">./gradlew assembleDevelopDebug --offline</code></pre> </li>       <li> <p>给你的单元测试加速:</p> <pre>  <code class="language-java">./gradlew test --offline</code></pre> </li>      </ul> </li>     <li> <p>使用一个抽象 <a href="/misc/goto?guid=4959741483033662082" rel="nofollow,noindex">Logger</a> 类</p> </li>     <li> <p>如果你想自动初始化你的库 Content Provider <a href="/misc/goto?guid=4959731595325913254" rel="nofollow,noindex">[Read how Firebase does it - Ref Link]</a></p> <p>译文 <a href="/misc/goto?guid=4959741483151026623" rel="nofollow,noindex">自动初始化你的库</a></p> </li>     <li> <p>使用 "android:extractNativeLibs:false" 在 <application> 减小包体积 </p> <p>这个属性是6.0开始的属性,告诉系统你不用把apk解压缩出来了,但是so不能被压缩,so 需要zipalign对齐,这个步骤不是自动的,我觉得慎用。</p> </li>     <li> <p>选择执行一个特定方法 </p> <p style="text-align:center"><img src="https://simg.open-open.com/show/98e554730c101ee5683a5beec36917ab.gif"></p> </li>     <li> <p>你收到过Google Play 违反政策的邮件吗? 别担心给你的app生成隐私策略</p> </li>    </ul>    <h3>*** UI/UX 相关***</h3>    <ul>     <li> <p>移动</p>      <ul>       <li>Material Design 使用的是现实风格的设计.现实世界中物体根据运动的性质在曲线上进行加速或者减速,而不是做直线运动.</li>       <li>所以移动也应该使用这样的属性或者动画来保持自然。</li>       <li>例如一辆车离开屏幕应该是先慢后快直到离开。同样的, 视图也应该使用插值器类例如 AccelerateInterpolator, FastOutSlowInInterpolator</li>       <li>等等 <a href="/misc/goto?guid=4959741483465255910" rel="nofollow,noindex">[更多参考]</a></li>      </ul> </li>     <li> <p>排版</p>      <ul>       <li>While custom typefaces can be used for branding, it is essential to stick to Roboto and Noto if possible, especially for body text, due to their clarity and optimistic nature.</li>       <li>Roboto covers Latin, Greek and Cyrillic extended scripts, with Noto filling in for other language scripts <a href="/misc/goto?guid=4959741483549971003" rel="nofollow,noindex">[More Info]</a></li>       <li>Weight balancing is an important aspect of typography, the fundamental concept of which is that the larger a typeface is, the less its weight should be so that it doesn't appear too thick and balances its weight with smaller typefaces of higher weights</li>       <li>Typography should align to a 4dp baseline grid, and maintain a minimum contrast ratio of 4.5:1 based on luminance values, with a recomemended ratio being 7:1.</li>       <li>The ideal reading length for large blocks of text is 40 to 60 characters per line. Anything less is too narrow and anything more is too wide.</li>      </ul> </li>     <li> <p>图标</p>      <ul>       <li>Icons should be designed at 48dp, with 1dp edges, which equates to        <ul>         <li>48px by 48px at mdpi</li>         <li>72px by 72px at hdpi</li>         <li>96px by 96px at xhdpi</li>         <li>144px by 144px at xxhdpi</li>         <li>192px by 192px at xxxhdpi</li>        </ul> </li>       <li>An additional icon of 512px by 512px should be designed for use on Google Play        <ul>         <li>Material icons, in addition to the base icon, should contain the following important elements</li>         <li>1dp tinted edge at the top</li>         <li>1dp shaded edge at the bottom</li>         <li>Contact shadow - a soft shadow around all edges of raised elements</li>         <li>Finish - a soft tint to provide surface lighting, fading from upper life to lower right </li>        </ul> </li>      </ul> </li>     <li> <p>水波纹</p>      <ul>       <li>使用 ?attr/selectableItemBackground 替代 ?android:attr </li>       <li> <p>在例如 Button 这种控件内部实现水波纹 </p> <pre>  <code class="language-java">android:background="?attr/selectableItemBackground"</code></pre> </li>       <li> <p>实现可溢出的水波纹: </p> <pre>  <code class="language-java">?attr/selectableItemBackgroundBorderless</code></pre> </li>      </ul> </li>     <li> <p>其他</p>      <ul>       <li>Views should be aligned to Material Design's 8dp baseline grid and the keylines when possible. This gives the UI a sense of structure and hierarchy. (这个说的是设计方面的,8dp基线我不知道是啥)</li>       <li>如果你要保留一个 ViewGroup 的引用(像 LinearLayout 、FrameLayout等等)又没有用到他们的特殊方法,就生命一个ViewGroup</li>       <li>accent color 和 primary color 颜色要互补,形成比较好的对比度。</li>      </ul> </li>    </ul>    <h3>Tips 关于 <a href="/misc/goto?guid=4958971138106631436" rel="nofollow,noindex">Kotlin</a></h3>    <ul>     <li> <p>关注 <a href="/misc/goto?guid=4959741484091157212" rel="nofollow,noindex">From Java to Kotlin</a></p> <p>Java 转 Kotlin 的 Cheatsheet.</p> </li>    </ul>    <h3><em>其他资源</em></h3>    <ul>     <li> <p>关注 podcasts</p>      <ol>       <li><a href="/misc/goto?guid=4958973724258090573" rel="nofollow,noindex">Fragmented</a></li>       <li> <p><a href="/misc/goto?guid=4959741484203737726" rel="nofollow,noindex">Android Developers Backstage</a></p> <p>这两个最为著名。</p> </li>      </ol> </li>     <li> <p>关注 <a href="/misc/goto?guid=4959741484276701480" rel="nofollow,noindex">Android Dialogs</a></p> <p>Android 专家的采访短视频。</p> </li>     <li> <p>关注 <a href="/misc/goto?guid=4959659993852585040" rel="nofollow,noindex">CodePath Android Cliffnotes</a></p> <p>有关于各种主题的完整的 Android 资源,并且实时更新。</p> </li>     <li> <p><a href="/misc/goto?guid=4959676102573521782" rel="nofollow,noindex">注意 copyright</a></p> </li>     <li> <p>关注新的 Android 开发库</p> <p><a href="/misc/goto?guid=4958876601261682866" rel="nofollow,noindex">Android Arsenal</a> - 和 Android 开发者相关的工具、库、app</p> </li>     <li> <p>关注 android example apps</p>      <ul>       <li><a href="/misc/goto?guid=4959741484447283190" rel="nofollow,noindex">Android Examples</a> - 简单的 Android 例子。</li>       <li><a href="/misc/goto?guid=4959624981983458152" rel="nofollow,noindex">Google Samples</a> - google 提供的多种 Android 例子</li>       <li><a href="/misc/goto?guid=4959741484567056698" rel="nofollow,noindex">Google Android Codelabs</a></li>      </ul> </li>     <li> <p>推ter上进行关注</p>      <ul>       <li><a href="/misc/goto?guid=4959741484643780301" rel="nofollow,noindex">#AndroidDev</a></li>      </ul> </li>     <li> <p>推ter 创建列表</p>      <ul>       <li><a href="/misc/goto?guid=4959741484725798577" rel="nofollow,noindex">Android List</a></li>      </ul> </li>     <li> <p><a href="/misc/goto?guid=4959741484802930615" rel="nofollow,noindex">阅读Effective Java</a></p>      <ul>       <li><a href="/misc/goto?guid=4959741484883333878" rel="nofollow,noindex">Cheatsheet/Summary</a></li>      </ul> </li>     <li> <p><a href="/misc/goto?guid=4959741484959411757" rel="nofollow,noindex">Subscribe to Caster.io</a></p> <p>Android开发视频</p> </li>     <li> <p>书签中加入这些网站</p>      <ul>       <li><a href="/misc/goto?guid=4959741485039671329" rel="nofollow,noindex">Android Developers - 油Tube Channel</a></li>       <li><a href="/misc/goto?guid=4958533902065359902" rel="nofollow,noindex">Android Niceties - UI Showcase</a></li>       <li><a href="/misc/goto?guid=4959741485164288756" rel="nofollow,noindex">Material Design Specs</a></li>       <li><a href="/misc/goto?guid=4959741118713128865" rel="nofollow,noindex">Everything About Material Design</a></li>       <li><a href="/misc/goto?guid=4959721556079505954" rel="nofollow,noindex">Platform Version Distribution</a></li>       <li><a href="/misc/goto?guid=4959741485292794139" rel="nofollow,noindex">Android Studio Release Notes</a></li>       <li><a href="/misc/goto?guid=4959741485381380864" rel="nofollow,noindex">Android Developers Blog</a></li>       <li><a href="/misc/goto?guid=4959741485457148730" rel="nofollow,noindex">AndroidDev-Reddit</a></li>       <li><a href="https://github.com/trending?l=java&since=weekly" rel="nofollow,noindex">Github Trending Java Projects</a></li>       <li><a href="/misc/goto?guid=4959741485620251231" rel="nofollow,noindex">Stackoverflow-Android tag</a></li>       <li><a href="/misc/goto?guid=4959677129491257171" rel="nofollow,noindex">Support Library History</a></li>       <li><a href="/misc/goto?guid=4959741485730678268" rel="nofollow,noindex">Android Conferences</a></li>       <li><a href="/misc/goto?guid=4959741485818716881" rel="nofollow,noindex">Android Dev Docs</a></li>       <li><a href="/misc/goto?guid=4959741485887879538" rel="nofollow,noindex">Material Up - DesignShowcase</a></li>       <li><a href="/misc/goto?guid=4959741485977237280" rel="nofollow,noindex">Dribbble - MaterialDeisgnShowcase</a></li>      </ul> </li>     <li> <p>使用免费的 mockable api</p>      <ul>       <li><a href="/misc/goto?guid=4959741486045509136" rel="nofollow,noindex">Mockey</a> - A tool for testing application interactions over http, with a focus on testing web services, specifically web applications that consume XML, JSON, and HTML.</li>       <li><a href="/misc/goto?guid=4959614020782618542" rel="nofollow,noindex">JSON Placeholder</a> - Fake Online REST API for Testing and Prototyping</li>       <li><a href="/misc/goto?guid=4959741486163374205" rel="nofollow,noindex">API Studio</a> - a playground for API developers</li>       <li><a href="/misc/goto?guid=4959741486240408860" rel="nofollow,noindex">Mocky</a> - Mock your HTTP responses to test your REST API</li>       <li><a href="/misc/goto?guid=4959741486326446339" rel="nofollow,noindex">Mockbin</a> - Mockbin allows you to generate custom endpoints to test, mock, and track HTTP requests & responses between libraries, sockets and APIs.</li>      </ul> </li>     <li> <p>订阅这些内容</p>      <ul>       <li><a href="/misc/goto?guid=4958822866262869795" rel="nofollow,noindex">Android Weekly</a> - Free newsletter that helps you to stay cutting-edge with your Android Development</li>       <li><a href="/misc/goto?guid=4959741486432836307" rel="nofollow,noindex">AndroidDevDigest</a> - A Handcrafted Weekly #AndroidDev Newsletter</li>       <li><a href="/misc/goto?guid=4959741486510126931" rel="nofollow,noindex">Infinium #AndroidSweets</a> - Fresh news from Droid zone</li>       <li><a href="http://us12.campaign-archive2.com/home/?u=f39692e245b94f7fb693b6d82&id=93b2272cb6" rel="nofollow,noindex">Kotlin Weekly</a> - Free newsletter to stay uptodate with Kotlin Development</li>      </ul> </li>     <li> <p><a href="/misc/goto?guid=4959733815699286243" rel="nofollow,noindex">ADB/Fastboot Tools made avaialble as a separate package by google</a> , download latest version for</p>      <ul>       <li><a href="/misc/goto?guid=4959741486716363311" rel="nofollow,noindex">MacOSX</a></li>       <li><a href="/misc/goto?guid=4959741486784219889" rel="nofollow,noindex">Linux</a></li>       <li><a href="/misc/goto?guid=4959741486872304231" rel="nofollow,noindex">Windows</a></li>      </ul> </li>     <li> <p>其他的一些优秀的开发工具</p>      <ul>       <li><a href="/misc/goto?guid=4959741486946951642" rel="nofollow,noindex">Android SVG to VectorDrawable</a> - 一个 VectorDrawable 适配所有屏幕分辨率</li>       <li><a href="/misc/goto?guid=4959741487026368347" rel="nofollow,noindex">SQLite Viewer</a> - 在线查看Sqlite</li>       <li><a href="/misc/goto?guid=4959741487106785317" rel="nofollow,noindex">Android 9-patch shadow generator</a> - 帮助实现可完全定制的阴影</li>       <li><a href="/misc/goto?guid=4959741487186412167" rel="nofollow,noindex">APK method count</a> - apk 方法数目统计</li>       <li><a href="/misc/goto?guid=4959741487269230689" rel="nofollow,noindex">Material Palette</a> - 快速生成 material 风格调色板</li>       <li><a href="/misc/goto?guid=4959741487349480461" rel="nofollow,noindex">Javadoc Themer</a> - 丰富你的JavaDoc</li>       <li><a href="/misc/goto?guid=4959716465984946117" rel="nofollow,noindex">Method Count</a></li>       <li><a href="/misc/goto?guid=4959741487460501992" rel="nofollow,noindex">Gradle, please</a> - 通过名称查出 Android 依赖</li>       <li><a href="/misc/goto?guid=4958832210121601500" rel="nofollow,noindex">jsonschema2pojo</a> - Json转Obj(我一般用GsonFormat)</li>       <li><a href="/misc/goto?guid=4959555277910092632" rel="nofollow,noindex">Android Asset Studio</a> - A web-based set of tools for generating graphics and other assets that would eventually be in an Android application's res/ directory.</li>       <li><a href="/misc/goto?guid=4959741487603216999" rel="nofollow,noindex">Device Art Generator</a> - Quickly wrap app screenshots in device artwork</li>       <li><a href="/misc/goto?guid=4959741487681005672" rel="nofollow,noindex">Google Translator Toolkit</a> - string.xml 快速翻译</li>       <li><a href="/misc/goto?guid=4959556349495199166" rel="nofollow,noindex">JSONViewer</a> - json格式化</li>       <li><a href="/misc/goto?guid=4959741487787932209" rel="nofollow,noindex">ShapeShifter</a> - SVG动画编辑器</li>       <li><a href="/misc/goto?guid=4959741487866545896" rel="nofollow,noindex">App Privacy Policy Generator</a> - 生成你google play 的隐私策略</li>      </ul> </li>     <li> <p>优秀的 android libraries</p>      <ul>       <li><a href="/misc/goto?guid=4958961776298570142" rel="nofollow,noindex">StorIO</a> - SQLiteDatabase 和 ContentResolver 的优雅封装</li>       <li><a href="/misc/goto?guid=4958964956869128717" rel="nofollow,noindex">Retrofit</a> - Square 出品 NB 网络库</li>       <li><a href="/misc/goto?guid=4958972548258164558" rel="nofollow,noindex">Picasso</a> - 优秀的图片加载库</li>       <li><a href="/misc/goto?guid=4958874766191309432" rel="nofollow,noindex">LeakCanary</a> - 内存泄露检查工具</li>       <li><a href="/misc/goto?guid=4958988893162801645" rel="nofollow,noindex">AndroidViewAnimations</a> - 可爱的动画合集</li>       <li> <p><a href="/misc/goto?guid=4958988894431381109" rel="nofollow,noindex">Calligraphy</a> - 最简单的自定义字体使用方法</p> </li>      </ul> </li>    </ul>    <p>作者的开源库(不是晓晨哦,这篇文档原作者)</p>    <ul>     <li><a href="/misc/goto?guid=4959674349559956793" rel="nofollow,noindex">EasyDeviceInfo</a> - Enabling device information to be at android developers hand like a piece of cake!</li>     <li><a href="/misc/goto?guid=4959724448678619693" rel="nofollow,noindex">Sensey</a> - Android library to make detecting gestures easy</li>     <li><a href="/misc/goto?guid=4959741488166795394" rel="nofollow,noindex">PackageHunter</a> - Android library to hunt down package information</li>     <li><a href="/misc/goto?guid=4959741488242389585" rel="nofollow,noindex">Zentone</a> - Easily generate audio tone in android</li>     <li><a href="/misc/goto?guid=4959714291313235364" rel="nofollow,noindex">RecyclerViewHelper</a> - RecyclerViewHelper provides the most common functions around recycler view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items.</li>     <li><a href="/misc/goto?guid=4959741488346223004" rel="nofollow,noindex">StackedHorizontalProgressbar</a> - Android Library to implement stacked horizontal progressbar</li>     <li><a href="/misc/goto?guid=4959741488432754294" rel="nofollow,noindex">QREader</a> - A library that uses google's mobile vision api and simplify the QR code reading process</li>     <li><a href="/misc/goto?guid=4959741488507241558" rel="nofollow,noindex">ScreenShott</a> - Simple library to take a screenshot of the device screen , programmatically!</li>     <li><a href="/misc/goto?guid=4959741488588562306" rel="nofollow,noindex">EvTrack</a> - Android library to make event and exception tracking easy</li>     <li><a href="/misc/goto?guid=4959741488671058282" rel="nofollow,noindex">OptimusHTTP</a> - Android library that simplifys networking in android via an async http client</li>     <li><a href="/misc/goto?guid=4959741488748693629" rel="nofollow,noindex">ShoutOut</a> - Android library for logging information in android</li>    </ul>    <p> </p>    <p>来自:https://juejin.im/entry/58c65e3aa22b9d0058b36be7</p>    <p> </p>