本文整理汇总了Java中android.widget.EditText.setFocusableInTouchMode方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setFocusableInTouchMode方法的具体用法?Java EditText.setFocusableInTouchMode怎么用?Java EditText.setFocusableInTouchMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setFocusableInTouchMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EditTextDialogBuilder
import android.widget.EditText; //导入方法依赖的package包/类
public EditTextDialogBuilder(Context context) {
super(context);
mEditText = new EditText(mContext);
mEditText.setHintTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_gray_3));
mEditText.setTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_black));
mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_content_message_text_size));
mEditText.setFocusable(true);
mEditText.setFocusableInTouchMode(true);
mEditText.setImeOptions(EditorInfo.IME_ACTION_GO);
mEditText.setGravity(Gravity.CENTER_VERTICAL);
mEditText.setId(R.id.qmui_dialog_edit_input);
mRightImageView = new ImageView(mContext);
mRightImageView.setId(R.id.qmui_dialog_edit_right_icon);
mRightImageView.setVisibility(View.GONE);
}
示例2: showSoftInputFromWindow
import android.widget.EditText; //导入方法依赖的package包/类
/**
* EditText获取焦点并显示软键盘
*/
public void showSoftInputFromWindow(EditText editText) {
//添加文字edittext弹出软键盘
editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.requestFocus();
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager) PostActivity.this
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
}
}, 100);//这里的时间大概是自己测试的
}
示例3: 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);
showSoftKeyboard();
} else {
hideSoftKeyboard();
}
}
示例4: toggleSoftInput
import android.widget.EditText; //导入方法依赖的package包/类
/**
* 切换键盘显示与否状态
*
* @param edit 输入框
*/
public static void toggleSoftInput(EditText edit) {
edit.setFocusable(true);
edit.setFocusableInTouchMode(true);
edit.requestFocus();
InputMethodManager inputManager = (InputMethodManager)
sContext.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null) {
inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
}
示例5: showSoftInput
import android.widget.EditText; //导入方法依赖的package包/类
public static void showSoftInput(EditText edit, Context context) {
edit.setFocusable(true);
edit.setFocusableInTouchMode(true);
edit.requestFocus();
InputMethodManager imm = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(edit, 0);
}
示例6: showSoftInputFromWindow
import android.widget.EditText; //导入方法依赖的package包/类
/**
* EditText获取焦点并显示软键盘
*/
public static void showSoftInputFromWindow(Activity activity, EditText editText) {
editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.requestFocus();
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
示例7: restartFocusable
import android.widget.EditText; //导入方法依赖的package包/类
/**
* 恢复焦点,打开键盘
* @param textView
*/
private void restartFocusable(EditText textView){
textView.setFocusable(true);
textView.setFocusableInTouchMode(true);
textView.requestFocus();
textView.findFocus();
textView.invalidate();
textView.setSelection(textView.getText().toString().length());//光标移动到最后一个字符
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
示例8: openSoftKeyboard
import android.widget.EditText; //导入方法依赖的package包/类
/**
* 开启软键盘
* @param et
*/
public static void openSoftKeyboard(EditText et) {
if (et != null) {
et.setFocusable(true);
et.setFocusableInTouchMode(true);
et.requestFocus();
InputMethodManager inputManager = (InputMethodManager) et.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(et, 0);
}
}
示例9: setEditTextEditable
import android.widget.EditText; //导入方法依赖的package包/类
/**
* 设置EditText是否可编辑
*
* @param editText 要设置的EditText
* @param value 可编辑:true 不可编辑:false
* @author com.tiantian
*/
public static void setEditTextEditable(EditText editText, boolean value)
{
if (value)
{
editText.setFocusableInTouchMode(true);
editText.requestFocus();
} else
{
editText.setFocusableInTouchMode(false);
editText.clearFocus();
}
}
示例10: showKeyboard
import android.widget.EditText; //导入方法依赖的package包/类
/**显示/隐藏输入法
* @param context
* @param et
* @param toGetWindowTokenView(为null时toGetWindowTokenView = et) 包含et的父View,键盘根据toGetWindowTokenView的位置来弹出/隐藏
* @param show
*/
public static void showKeyboard(Context context, EditText et, View toGetWindowTokenView, boolean show){
if (context == null) {
Log.e(TAG, "showKeyboard context == null >> return;");
return;
}
imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);//imm必须与context唯一对应
if (toGetWindowTokenView == null) {
Log.w(TAG, "showKeyboard toGetWindowTokenView == null");
toGetWindowTokenView = et;
}
if (toGetWindowTokenView == null) {
Log.e(TAG, "showKeyboard toGetWindowTokenView == null && et == null >> return;");
return;
}
if (show == false) {
imm.hideSoftInputFromWindow(toGetWindowTokenView.getWindowToken(), 0);
if (et != null) {
et.clearFocus();
}
} else {
if (et != null) {
et.setFocusable(true);
et.setFocusableInTouchMode(true);
et.requestFocus();
imm.toggleSoftInputFromWindow(toGetWindowTokenView.getWindowToken()
, InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
}
}
示例11: showKeyboard
import android.widget.EditText; //导入方法依赖的package包/类
/**显示/隐藏输入法
* @param context
* @param et
* @param toGetWindowTokenView(为null时toGetWindowTokenView = et) 包含et的父View,键盘根据toGetWindowTokenView的位置来弹出/隐藏
* @param show
*/
public static void showKeyboard(Context context, EditText et, View toGetWindowTokenView, boolean show){
if (context == null) {
Log.e(TAG, "showKeyboard context == null >> return;");
return;
}
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);//imm必须与context唯一对应
if (toGetWindowTokenView == null) {
Log.w(TAG, "showKeyboard toGetWindowTokenView == null");
toGetWindowTokenView = et;
}
if (toGetWindowTokenView == null) {
Log.e(TAG, "showKeyboard toGetWindowTokenView == null && et == null >> return;");
return;
}
if (show == false) {
imm.hideSoftInputFromWindow(toGetWindowTokenView.getWindowToken(), 0);
if (et != null) {
et.clearFocus();
}
} else {
if (et != null) {
et.setFocusable(true);
et.setFocusableInTouchMode(true);
et.requestFocus();
imm.toggleSoftInputFromWindow(toGetWindowTokenView.getWindowToken()
, InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
}
}
示例12: showSoftInput
import android.widget.EditText; //导入方法依赖的package包/类
/**
* 动态显示软键盘
*/
public static void showSoftInput(Context context, EditText edit) {
edit.setFocusable(true);
edit.setFocusableInTouchMode(true);
edit.requestFocus();
InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(edit, 0);
}
示例13: showSoftInputFromWindow
import android.widget.EditText; //导入方法依赖的package包/类
public static void showSoftInputFromWindow(Activity activity, EditText editText) {
editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.requestFocus();
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
示例14: disableEditText
import android.widget.EditText; //导入方法依赖的package包/类
public static void disableEditText(EditText editText){
editText.setFocusable(false);
editText.setEnabled(false);
editText.setFocusableInTouchMode(false);
}
示例15: enableEditText
import android.widget.EditText; //导入方法依赖的package包/类
public static void enableEditText(EditText editText){
editText.setFocusable(true);
editText.setEnabled(true);
editText.setFocusableInTouchMode(true);
}