本文整理了Java中android.widget.Button.postDelayed()
方法的一些代码示例,展示了Button.postDelayed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.postDelayed()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:postDelayed
暂无
代码示例来源:origin: bingoogolapple/BGASwipeBackLayout-Android
public void hideNavigationBar(View view) {
mControlBtn.postDelayed(new Runnable() {
@Override
public void run() {
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
mControlBtn.setVisibility(View.INVISIBLE);
}
}, 2000);
}
}
代码示例来源:origin: quaap/LaunchTime
private void endItAll() {
final Button sendIt = findViewById(R.id.err_report_btn);
sendIt.postDelayed(new Runnable() {
@Override
public void run() {
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
}, 2000);
}
代码示例来源:origin: stackoverflow.com
private long lastClicked;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
lastClicked = System.currentTimeMillis();
}
});
lastClicked = System.currentTimeMillis();
button.postDelayed(new Runnable() {
@Override
public void run() {
if(System.currentTimeMillis() - lastClicked > 5000) {
button.setVisibility(View.INVISIBLE);
}
else {
button.postDelayed(this, 1000);
}
}
}, 1000);
代码示例来源:origin: stackoverflow.com
final Button button = findViewById(R.id.button);
final Runnable runnable = new Runnable() {
@Override public void run() {
// Replace with your logic.
button.setOnClickListener(null);
}
};
button.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(final View view) {
//Removing 5 Seconds timer which will remove click listener.
view.removeCallbacks(runnable);
}
});
//Removed Click Listener after 5 Seconds.
button.postDelayed(runnable, 5000);
内容来源于网络,如有侵权,请联系作者删除!