有一个持续2秒的过程,在此过程中,我需要锁定整个屏幕和手机的按钮。有一个代码仅禁用取消过程。
public void onClick(View view) {
int pos = getAdapterPosition();
dialog= new ProgressDialog(context);
dialog.setMessage("Please wait ...");
dialog.setCancelable(false);
dialog.show();
if(pos != RecyclerView.NO_POSITION){
LanguageRecycler clickedDataItem = mData.get(pos);
SharedPrefManager.getmInstance(context).setCity(clickedDataItem.getAlias());
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
((Activity)context).finish();
}
}, 2000);
}
}
答案 0 :(得分:-2)
这将禁用按钮
var StartsWith;
StartsWith = 'txt';
$('[id^=' + StartsWith + ']').each(function () {
if (this.value == 'myStringToCompare') {
alert(this.id);
}
});
答案 1 :(得分:-2)
尝试这个
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
//do something or nothing here
return true;
}
return super.onKeyDown(keyCode, event);
}