美文网首页Android
那些有意思的Android开发工具系列一(Scalpel和Hug

那些有意思的Android开发工具系列一(Scalpel和Hug

作者: Zach_C | 来源:发表于2017-02-08 13:49 被阅读56次

Scalpel

江湖人称大神Jake Wharton的第三把刀,都好几年的历史了,源码地址https://github.com/JakeWharton/scalpel

官方一句话介绍:A surgical debugging tool to uncover the layers under your app.看下图就可以知道用来查看界面的图层,3D的效果
盗用Jake Wharton的sample.gif

由上图可知道,虽然使用价值可能没有Hirearchy Viewer强大,但它的确很炫,接下来就看怎么使用吧。

大神已经告诉我们有三种加载方式了


三种加载方式.png
  1. jar文件
  2. compile 'com.jakewharton.scalpel:scalpel:1.1.2'
<dependency>
  <groupId>com.jakewharton.scalpel</groupId>
  <artifactId>scalpel</artifactId>
  <version>1.1.2</version>
</dependency>

layout根节点必须是 ScalpelFrameLayout(com.jakewharton.scalpel.ScalpelFrameLayout) , 常用的方法:

  1. 开启3D效果 : setLayerInteractionEnabled(boolean).
  2. 显隐DrawViews:setDrawViews(boolean).
  3. 显隐 View ID: setDrawIds(boolean).
  4. 修改边框的颜色和阴影 setChromeColor(int) 和setChromeShadowColor(int).

Hugo

出自Jake Wharton大神的Log工具,可以在log中打印每个方法的执行时间,甚至把执行方法时的输入输出同时打印,源码地址https://github.com/JakeWharton/hugo

配置:

  1. 在Project级别的build.gradle dependencies 内加入
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
    }
}
  1. 在Module级别的build.gradle的顶部加入
    apply plugin: 'com.jakewharton.hugo'
  2. 然后在相应的方法上添加@DebugLog注解就行

需要关闭Hugo时,可以

    enabled false
 }```

相关文章

网友评论

    本文标题:那些有意思的Android开发工具系列一(Scalpel和Hug

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