當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。