???????дAndroid???????????????????????????????????????????Android?汾????????????е?ú???????????????????汾??Android??????????в????????????????????????????????View?????????????robotium??click???????????

????View view = ... // ???????????????View?????

????solo.click(view); // ?????????

????????????????????е??????????????????????????????????????в????汾??????????????????????????????汾???????е?ú????????????????汾????????????????????

??????????????????????????Android??????????????????????????????п????????????????????????????С?????????????????????????Щ????????????????????С?Щ????????????

????????Щ?????????????????????????????????????????????????????С – ?????dp??λ?????dp??λ?????е?????????????????????????????????????????????????????????android??????????????????????????????????????????????????????????????С????μ????????????

????????????????????????????????Щ??????Android?????????????????????????????????????????????????????????????????????????16????????????????????????????????????? 16???? / 160 dpi????????????磨??2.5???????????????????????棬??????????16???? / 240 dpi?????????????磨??1.7??????????????????????????????????????????????о????????????????????Щ??

???????????????????????棬??????DPI?????С?????????????????????????????????????????????????????????????robotium?????instrumentation??????android??????????????????????????????????λ???x??y????Robotium???????????????????????

????1????????????????View???????

????2?????View. getLocationOnScreen?????????????????????????????????λ???????

????3?????View.getWidth??View.getHeight?????????????С??

????4????????????????м?λ??????λ???????????????????????С????ó????????λ????????

????5?????robotium??????λ???x??y?????????????android??????

1:  public void clickOnScreen(float x?? float y) {
2:      long downTime = SystemClock.uptimeMillis();
3:      long eventTime = SystemClock.uptimeMillis();
4:      MotionEvent event = MotionEvent.obtain(downTime?? eventTime??
5:              MotionEvent.ACTION_DOWN?? x?? y?? 0);
6:      MotionEvent event2 = MotionEvent.obtain(downTime?? eventTime??
7:              MotionEvent.ACTION_UP?? x?? y?? 0);
8:      try{
9:          inst.sendPointerSync(event);
10:          inst.sendPointerSync(event2);
11:          sleeper.sleep(MINISLEEP);
12:      }catch(SecurityException e){
13:          Assert.assertTrue("Click can not be completed!"?? false);
14:      }
15:  }