本文整理汇总了Java中android.widget.EditText.postDelayed方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.postDelayed方法的具体用法?Java EditText.postDelayed怎么用?Java EditText.postDelayed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.postDelayed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAutofocus
import android.widget.EditText; //导入方法依赖的package包/类
@WXComponentProp(name = Constants.Name.AUTOFOCUS)
public void setAutofocus(boolean autofocus) {
if (getHostView() == null) {
return;
}
mAutoFocus = autofocus;
EditText inputView = getHostView();
if (mAutoFocus) {
inputView.setFocusable(true);
inputView.requestFocus();
inputView.setFocusableInTouchMode(true);
inputView.postDelayed(new Runnable() {
@Override
public void run() {
showSoftKeyboard();
}
}, 16);
} else {
inputView.postDelayed(new Runnable() {
@Override
public void run() {
hideSoftKeyboard();
}
}, 16);
}
}
示例2: showSoftKeyboardDelayed
import android.widget.EditText; //导入方法依赖的package包/类
public static void showSoftKeyboardDelayed(final EditText editText, long delay){
editText.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}
}, delay);
}
示例3: setNumber
import android.widget.EditText; //导入方法依赖的package包/类
private void setNumber(View row, String number) {
final EditText numberEdit = (EditText) row.findViewById(R.id.edit_number);
numberEdit.setText(number);
if (number == null || number.isEmpty()) {
numberEdit.postDelayed(new Runnable() {
@Override
public void run() {
numberEdit.requestFocus();
}
}, 100);
}
}
示例4: getInputViewLoacation
import android.widget.EditText; //导入方法依赖的package包/类
public static int[] getInputViewLoacation() {
final int[] locations = new int[2];
if (inputDialog != null || inputDialog.isShowing()) {
final EditText inputView = (EditText) inputDialog.getInputView();
inputView.postDelayed(new Runnable() {
@Override
public void run() {
inputView.getLocationInWindow(locations);
}
}, 500);
}
return locations;
}
示例5: showKeyboard
import android.widget.EditText; //导入方法依赖的package包/类
private void showKeyboard(final EditText etSearch) {
etSearch.postDelayed(new Runnable() {
public void run() {
etSearch.requestFocus();
}
}, 300);
}