screenshot-tests-for-android Android 开发包开源项目

我要开发同款
匿名用户2016年02月12日
26阅读
开发技术Java
所属分类AndroidUI组件、手机/移动开发、Android UI 组件
授权协议BSD

作品详情

screenshot-tests-for-android是来自Facebook的一个Android开发包,用于在Android程序中实现自动的屏幕截屏功能。

示例代码:

public class MyTests {  @Test  public void doScreenshot() {    /*     * Create and set up your view some how. This might be inflating,     * or creating from a view class. You might want to set properties     * on the view.     */    View view = mLayoutInflater.inflate(R.layout.my_layout, null, false);    /*     * Measure and layout the view. In this example we give an exact     * width but all the height to be WRAP_CONTENT.     */    ViewHelpers.setupView(view)      .setExactWidthDp(300)      .layout();    /*     * Take the actual screenshot. At the end of this call the screenshot     * is stored on the device, and the gradle plugin takes care of     * pulling it and displaying it to you in nice ways.     */    Screenshot.snap(view)      .record();  }}
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论