appium连接虚拟机后怎么获取控件
答案:1 悬赏:0 手机版
解决时间 2021-11-20 22:10
- 提问者网友:轮囘Li巡影
- 2021-11-19 23:21
appium连接虚拟机后怎么获取控件
最佳答案
- 五星知识达人网友:愁杀梦里人
- 2021-11-19 23:50
第一步: 创建Android project 在onCreate方法里添加一个button控件
1 Button bt = new Button(this);
2 bt.setText("Test");
3 bt.setPadding(300, 0, 0, 0);
4
5 RelativeLayout relativeLayout = (RelativeLayout) getLayoutInflater()
6 .inflate(R.layout.activity_main, null);
7 RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
8 ViewGroup.LayoutParams.MATCH_PARENT,
9 ViewGroup.LayoutParams.WRAP_CONTENT);
10 layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, -1);
11 relativeLayout.addView(bt, layoutParams);
12 setContentView(relativeLayout);
1 Button bt = new Button(this);
2 bt.setText("Test");
3 bt.setPadding(300, 0, 0, 0);
4
5 RelativeLayout relativeLayout = (RelativeLayout) getLayoutInflater()
6 .inflate(R.layout.activity_main, null);
7 RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
8 ViewGroup.LayoutParams.MATCH_PARENT,
9 ViewGroup.LayoutParams.WRAP_CONTENT);
10 layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, -1);
11 relativeLayout.addView(bt, layoutParams);
12 setContentView(relativeLayout);
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯