我需要点击intent ACTION_SEND的按钮。这里不需要显示UI。我可以在Android的MMS-SMSProvider中点击"Send“按钮吗?
发布于 2011-04-18 18:43:24
可以使用button.performClick()
方法以编程方式单击按钮。
发布于 2013-04-01 15:30:41
如果您的按钮包含任何动画,则需要执行单击,然后在performClick之后使每个步骤无效。下面是操作步骤:
button.performClick();
button.setPressed(true);
button.invalidate();
button.setPressed(false);
button.invalidate();
有时,我还不得不引入延迟来显示动画。如下所示:
//initiate the button
button.performClick();
button.setPressed(true);
button.invalidate();
// delay completion till animation completes
button.postDelayed(new Runnable() { //delay button
public void run() {
button.setPressed(false);
button.invalidate();
//any other associated action
}
}, 800); // .8secs delay time
发布于 2018-10-04 22:28:02
button.callOnClick();
这个也可以使用
https://stackoverflow.com/questions/5701666
复制相似问题