您的位置:首页 > 移动开发 > Android开发

Android Robotium测试中如何获取当前某个文本的背景颜色

2013-09-29 16:37 387 查看
TextView tv = (TextView)solo.getView(TextView.class,4);

ColorDrawable dr = (ColorDrawable) tv.getBackground();

int col_int = dr.getColor();

Log.d("TestPhone", Color.RED+" 红色的数字");

Log.d("TestPhone", col_int+" 获取的颜色");


assertEquals("The result is ", col_int, Color.RED);

如下图:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: