然后查看控件信息显示
bounds(31,77,47,106)
clickable为false
className为android.widget.ImageView
depth为12 ,
indexInParent为0,
如何实现这种控件的点击操作呢?
之前试了下面2种方法均无效,有没有大神有其他方法可以实现这种控件的点击操作呢?
[color=]// 方法1
[color=]var
[color=]textView
=
[color=]className
(
[color=]"TextView"
).
[color=]text
(
[color=]"人员管理"
).
[color=]findOne
();
[color=]if
(
[color=]textView
) {
[color=]var
[color=]bounds
=
[color=]textView
.
[color=]bounds
();
[color=]// 获取控件的坐标
[color=]var
[color=]x
=
[color=]bounds
.
[color=]centerX
();
[color=]var
[color=]y
=
[color=]bounds
.
[color=]centerY
();
[color=]// 模拟点击
[color=]click
(
[color=]x
,
[color=]y
);
}
// 方法2
[color=]widget
=
[color=]id
(
[color=]"back_iv"
).
[color=]findOne
();
[color=]let
[color=]bounds
=
[color=]widget
.
[color=]bounds
();
[color=]let
[color=]centerX
= (
[color=]bounds
.
[color=]left
+
[color=]bounds
.
[color=]right
) /
[color=]2
;
[color=]let
[color=]centerY
= (
[color=]bounds
.
[color=]top
+
[color=]bounds
.
[color=]bottom
) /
[color=]2
;
[color=]click
(
[color=]centerX
,
[color=]centerY
);