当前位置: 首页>>代码示例>>Java>>正文


Java EditText.setInputType方法代码示例

本文整理汇总了Java中android.widget.EditText.setInputType方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setInputType方法的具体用法?Java EditText.setInputType怎么用?Java EditText.setInputType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.EditText的用法示例。


在下文中一共展示了EditText.setInputType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hideSoftInput

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * 屏蔽输入法, 对于当前输入框(要进行深入的测试)
 * 
 * @param activity
 * @param editText
 */
@Deprecated
public static void hideSoftInput(Activity activity, EditText editText)
{
	if (android.os.Build.VERSION.SDK_INT <= 100)
	{
		// 4.0
		editText.setInputType(InputType.TYPE_NULL);
	}
	else
	{
		activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
		try
		{
			Class<EditText> cls = EditText.class;
			Method setShowSoftInputOnFocus;
			setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
			setShowSoftInputOnFocus.setAccessible(true);
			setShowSoftInputOnFocus.invoke(editText, false);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:32,代码来源:ViewUtils.java

示例2: showEditTextDialog

import android.widget.EditText; //导入方法依赖的package包/类
@SuppressLint("InflateParams")
public static AlertDialog showEditTextDialog(BaseActivity activity, String title, String content,
                                             boolean isPassword, EditTextDialogCallback callback) {
    View layout = LayoutInflater.from(activity).inflate(R.layout.view_dialog_edit_text, null);
    EditText input = (EditText) layout.findViewById(R.id.edit_text);
    input.setText(content);
    if (isPassword) {
        input.setInputType(InputType.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
    }
    input.setSelection(input.getText().length());

    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(title);
    builder.setView(layout);
    builder.setPositiveButton("确定", (dialog, which) -> {
        if (callback != null) {
            callback.onSuccess(input.getText().toString());
        }
    });
    builder.setNegativeButton("取消", (dialog, which) -> dialog.dismiss());

    return builder.show();
}
 
开发者ID:dss886,项目名称:Transmis,代码行数:24,代码来源:DialogBuilder.java

示例3: popup_getNumber_show

import android.widget.EditText; //导入方法依赖的package包/类
public void popup_getNumber_show(String popup_title, String popup_hint, DialogInterface.OnClickListener positiveOCL,DialogInterface.OnClickListener negativeOCL, String positiveText, String negativeText)
{
    //by default, the pop up dialogue content is text input
    //build popup dialogue
    popUpWindow = new AlertDialog.Builder(context);
    popUpWindow.setTitle(popup_title);

    //set up the input field
    popup_inputText = new EditText(context);
    popup_inputText.setInputType(InputType.TYPE_CLASS_NUMBER);
    popup_inputText.setHint(popup_hint); //set hint on what value the user should enter
    popUpWindow.setView(popup_inputText);

    //set up positive button
    popUpWindow.setPositiveButton(positiveText, positiveOCL);

    //set up negative button
    popUpWindow.setNegativeButton(negativeText, negativeOCL);

    popUpWindow.show();
}
 
开发者ID:FYP17-4G,项目名称:Aardvark,代码行数:22,代码来源:App_Framework.java

示例4: inflateView

import android.widget.EditText; //导入方法依赖的package包/类
@Override
public View inflateView(LinearLayout layout, String value) {
	editText = new EditText(context);
	editText.setSingleLine();
	editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
	if (value != null) {
		editText.setText(value);
	}
	return inflater.new EditBuilder(layout, editText).withLabel(attribute.name).create();
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:11,代码来源:AttributeView.java

示例5: onCreate

import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_config_sync);
	

	
	volumeName = (EditText) findViewById(R.id.volumeName);
	//volumeName.setFocusable(false);
	
	volumePath = (EditText) findViewById(R.id.volumePath);
	//volumePath.setFocusable(false);
	
	password = (EditText) findViewById(R.id.volumePassword);
	password.setTransformationMethod(PasswordTransformationMethod.getInstance());
	password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); 
	
	onlyWifiCheckBox = ((CheckBox) findViewById(R.id.onlyWifi));
	removeAfterCheckBox = ((CheckBox) findViewById(R.id.removeAfter));
	localFolder = ((EditText) findViewById(R.id.localFolder));
	syncID = ((EditText) findViewById(R.id.syncID));
	syncID.setFocusable(false);
	
	
	spin1=(Spinner) findViewById(R.id.selectedRule);
	ArrayAdapter<String> adapter=new ArrayAdapter<String>(ConfigSyncActivity.this, android.R.layout.simple_spinner_item, rules);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spin1.setAdapter(adapter);
	spin1.setOnTouchListener(this);
	spin1.setOnItemSelectedListener((OnItemSelectedListener) this);
	
	refresh(null);

	
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:36,代码来源:ConfigSyncActivity.java

示例6: initView

import android.widget.EditText; //导入方法依赖的package包/类
private void initView() {
    clearBtn = (Button) findViewById(R.id.btn_clear);
    clearBtn.setOnClickListener(this);
    serviceBtn = (Button) findViewById(R.id.btn_service);
    serviceBtn.setOnClickListener(this);
    bindAliasBtn = (Button) findViewById(R.id.btn_bind_alias);
    bindAliasBtn.setOnClickListener(this);
    unbindAliasBtn = (Button) findViewById(R.id.btn_unbind_alias);
    unbindAliasBtn.setOnClickListener(this);

    btnAddTag = (Button) findViewById(R.id.btnAddTag);
    btnAddTag.setOnClickListener(this);
    btnVersion = (Button) findViewById(R.id.btnVersion);
    btnVersion.setOnClickListener(this);
    btnSilentime = (Button) findViewById(R.id.btnSilentime);
    btnSilentime.setOnClickListener(this);
    btnGetCid = (Button) findViewById(R.id.btnGetCid);
    btnGetCid.setOnClickListener(this);

    tView = (TextView) findViewById(R.id.tvclientid);
    appKeyView = (TextView) findViewById(R.id.tvappkey);
    appSecretView = (TextView) findViewById(R.id.tvappsecret);
    masterSecretView = (TextView) findViewById(R.id.tvmastersecret);
    appIdView = (TextView) findViewById(R.id.tvappid);
    tLogView = (EditText) findViewById(R.id.tvlog);
    tLogView.setInputType(InputType.TYPE_NULL);
    tLogView.setSingleLine(false);
    tLogView.setHorizontallyScrolling(false);
    transmissionBtn = (Button) findViewById(R.id.btn_pmsg);
    transmissionBtn.setOnClickListener(this);
    notifactionBtn = (Button) findViewById(R.id.btn_psmsg);
    notifactionBtn.setOnClickListener(this);
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:34,代码来源:GetuiSdkDemoActivity.java

示例7: createEditText

import android.widget.EditText; //导入方法依赖的package包/类
private EditText createEditText() {
	LinearLayout.LayoutParams EditTextlayoutParams = new LinearLayout.LayoutParams(
			LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
	EditText editText = new EditText(getContext());
	editText.setLayoutParams(EditTextlayoutParams);
	editText.setHint(getString(R.string.answer, letters[inputLayout.getChildCount()]));
	editText.setInputType(InputType.TYPE_CLASS_TEXT);
	return editText;
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:10,代码来源:QuestionFragment.java

示例8: showDialog

import android.widget.EditText; //导入方法依赖的package包/类
private void showDialog(List<EncdroidProviderParameter> questions){
	
	if (questions==null || questions.size()==0) {
       	//if (activity instanceof Fillable){
       		try {
       			//this.init("/");*
       			finishFileProviderInit();
       		} catch (Exception e){
       			e.printStackTrace();
       			String exceptionLabel = e.getMessage();
       			if (exceptionLabel==null) exceptionLabel=e.toString();
       			Toast.makeText(this.getApplicationContext(),exceptionLabel, Toast.LENGTH_LONG).show();
       			//ask again parameters question to the user
       			if (instance.getParamsToAsk()!=null && instance.getParamsToAsk().size()>0){
       				this.showDialog( instance.getParamsToAsk());
       			}
       			return;
       		}
       	//}			
   		//this.ready=true;
  			//((Fillable)activity).launchFillTask();			
		return;
	}
	
    AlertDialog.Builder alert = new AlertDialog.Builder(this);                 
    alert.setTitle(questions.get(0).getTitle());  
    alert.setMessage(questions.get(0).getLabel());
     

     // Set an EditText view to get user input   
     final EditText input = new EditText(this);
     if (questions.get(0).isPassword()) {
    	 input.setTransformationMethod(PasswordTransformationMethod.getInstance());
    	 input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); 
     }
     alert.setView(input);
        alert.setPositiveButton("Ok", new ClickListener(this,instance,input,questions));  
        alert.show();
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:40,代码来源:FileProviderActivity.java

示例9: setupEditText

import android.widget.EditText; //导入方法依赖的package包/类
protected void setupEditText(EditText editText) {
	editText.setInputType(InputType.TYPE_NULL);
	editText.setFilters(filters);
	editText.setOnTouchListener(touchListener);
	editText.setTransformationMethod(PasswordTransformationMethod
			.getInstance());
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:8,代码来源:AppLockActivity.java

示例10: initFilenameInputDialog

import android.widget.EditText; //导入方法依赖的package包/类
public static void initFilenameInputDialog(MaterialDialog show) {
    final EditText editText = show.getInputEditText();
    editText.setSingleLine();
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER);
    editText.setImeOptions(EditorInfo.IME_ACTION_DONE);

    // create an initial filename to suggest to the user
    String filename = createLogFilename();
    editText.setText(filename);

    // highlight everything but the .txt at the end
    editText.setSelection(0, filename.length() - 4);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:DialogHelper.java

示例11: onCreate

import android.widget.EditText; //导入方法依赖的package包/类
@Override
   protected void onCreate(Bundle savedInstanceState){
       super.onCreate(savedInstanceState);
       setTitle("====== " + getString(R.string.config_polar_title) + " ======");	// title should not be too short, otherwise, dialog will be too narrow.
       EditText edtXFrom = (EditText)findViewById(R.id.x_from_edit);
       edtXFrom.setText("0");
       edtXFrom.setEnabled(false);
       EditText edtXTo = (EditText)findViewById(R.id.x_to_edit);
       edtXTo.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
       TextView tvXInputNote = (TextView)findViewById(R.id.x_input_note);
       tvXInputNote.setText(getString(R.string.polar_chart_r_range_note));
       TextView tvYInputNote = (TextView)findViewById(R.id.y_input_note);
       tvYInputNote.setText(getString(R.string.polar_chart_angle_range_note) + " " + getString(R.string.degree) + ".");
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:15,代码来源:ActivityConfigPolarExprGraph.java

示例12: popup_show

import android.widget.EditText; //导入方法依赖的package包/类
public void popup_show(String popup_title, String popup_hint, DialogInterface.OnClickListener clickListener)
{
    //build popup dialogue
    popUpWindow = new AlertDialog.Builder(context);
    popUpWindow.setTitle(popup_title);

    //set up the input field
    popup_inputText = new EditText(context);
    popup_inputText.setInputType(InputType.TYPE_CLASS_TEXT);
    popup_inputText.setHint(popup_hint); //set hint on what value the user should enter
    popUpWindow.setView(popup_inputText);

    //set up positive button
    popUpWindow.setPositiveButton("OK",clickListener);

    //set up negative button
    popUpWindow.setNegativeButton("Cancel", new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialogInterface, int i)
        {
            dialogInterface.cancel();
        }
    });

    popUpWindow.show();
}
 
开发者ID:FYP17-4G,项目名称:Aardvark,代码行数:28,代码来源:App_Framework.java

示例13: setCardInput

import android.widget.EditText; //导入方法依赖的package包/类
public void setCardInput(Context context){
    EditText input=  ((EditText) findViewById(R.id.inputEdit));
    input.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    input.setKeyListener(DigitsKeyListener.getInstance(context.getResources().getString(R.string.filter_vcode)));
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:6,代码来源:OneInputDialog.java

示例14: EditTextCell

import android.widget.EditText; //导入方法依赖的package包/类
public EditTextCell(View itemView) {
    super(itemView);
    iv_icon = (ImageView) itemView.findViewById(R.id.iv_icon);
    et_content = (EditText) itemView.findViewById(R.id.et_content);
    et_content.setInputType(EditorInfo.TYPE_CLASS_TEXT);//默认 文字键盘
}
 
开发者ID:xiaoshanlin000,项目名称:SLTableView,代码行数:7,代码来源:EditTextCell.java

示例15: onCreate

import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(mResourceId);

	try {
		LinearLayout root = (LinearLayout) findViewById(R.id.easy_edit_dialog_root);
		ViewGroup.LayoutParams params = root.getLayoutParams();
		params.width = (int) ScreenUtil.getDialogWidth();
		root.setLayoutParams(params);

		if (mTitle != null) {
			mTitleTextView = (TextView) findViewById(R.id.easy_dialog_title_text_view);
			mTitleTextView.setText(mTitle);
		}

		if (mMessage != null) {
			mMessageTextView = (TextView) findViewById(R.id.easy_dialog_message_text_view);
			mMessageTextView.setText(mMessage);
			mMessageTextView.setVisibility(View.VISIBLE);
		}

		mEdit = (EditText) findViewById(R.id.easy_alert_dialog_edit_text);
		mLengthTextView = (TextView) findViewById(R.id.edit_text_length);
		// mEdit.setFilters(new InputFilter[] { new InputFilter.LengthFilter(mMaxEditTextLength) });
		mLengthTextView.setVisibility(mShowEditTextLength ? View.VISIBLE : View.GONE);
		if (inputType != -1) {
			mEdit.setInputType(inputType);
		}
		mEdit.addTextChangedListener(new EditTextWatcher(mEdit, mLengthTextView, mMaxEditTextLength,
				mShowEditTextLength));

		if (!TextUtils.isEmpty(mEditHint)) {
			mEdit.setHint(mEditHint);
		}
		if (mMaxLines > 0) {
			mEdit.setMaxLines(mMaxLines);
		}
		if (mSingleLine) {
			mEdit.setSingleLine();
		}

		mPositiveBtn = (Button) findViewById(R.id.easy_dialog_positive_btn);
		if (mPositiveBtnStrResId != 0) {
			mPositiveBtn.setText(mPositiveBtnStrResId);
		}
		mPositiveBtn.setOnClickListener(mPositiveBtnListener);

		mNegativeBtn = (Button) findViewById(R.id.easy_dialog_negative_btn);
		if (mNegativeBtnStrResId != 0) {
			mNegativeBtn.setText(mNegativeBtnStrResId);
		}
		mNegativeBtn.setOnClickListener(mNegativeBtnListener);
		mNegativeBtn.setVisibility(View.VISIBLE);
		findViewById(R.id.easy_dialog_btn_divide_view).setVisibility(View.VISIBLE);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:60,代码来源:EasyEditDialog.java


注:本文中的android.widget.EditText.setInputType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。