????????????????????????????°???????????????????????????????
????1???????????solo.clickOnText("^????")
????????????solo.waitForText("^????"?? 1?? 10000);
????solo.enterText(0?? "00195852");
????solo.enterText(1?? "password");
????2?????????????????????淽???????
????clickOnScreen??float x?? float y??
????x??y???????????????????е?????λ?á??????????????
?????????????λ???????1/2??????????????????????????????????????£?
????//1???????
????import android.util.DisplayMetrics;
????//2???????????????????
????private DisplayMetrics dm ;
????//3???????????
????dm = new DisplayMetrics();
????solo.getCurrentActivity().getWindowManager().getDefaultDisplay().getMetrics(dm) ;
????//4?????????????????????λ?px
????String str = "????????????:" + dm.widthPixels+"??*??"+dm.heightPixels;
????????????????м?clickOnScreen??dm.widthPixels/2??dm.heightPixels/2)
????3?????ID???????????????£?
private int clickCtrlById(String s?? int t){
int ctrl;
View v;
if( s == ""){
return -1;
}
ctrl = solo.getCurrentActivity().getResources().getIdentifier(s??"id"??solo.getCurrentActivity().getPackageName());
v = solo.getView(ctrl);
solo.clickOnView(v);
solo.sleep(t);
return 0;
}
private int enterTextById(String id?? String s?? int t ){
int ctrl;
EditText v;
if( s == ""){
return -1;
}
ctrl = solo.getCurrentActivity().getResources().getIdentifier(id??"id"??solo.getCurrentActivity().getPackageName());
v = (EditText) solo.getView(ctrl);
solo.enterText(v?? s) ;
solo.sleep(t);
return 0;
}
????????÷??????
????clickCtrlById("ID"?? 10000) ;
????enterTextById("ID"??"??????????"??10000)
??????????????????????????????????????????????
????????????????id???????????????·??????ID???????岻????????????????string??????????????????????????????????????£???п?????
????Activity act=solo.getCurrentActivity();//???Activity
????int id=act.getResources().getIdentifier("^????"?? "id"?? act.getPackageName());//???String??id???int??id
????View view=act.findViewById(id);//???View
????solo.clickOnView(view);//???
??????δ???????????????????????????????ID?????????id???????黹???????
?????????????????????????