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

来源:互联网 发布:java 数组定义方式 编辑:程序博客网 时间:2024/04/29 08:54
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);


如下图: