當前位置: 首頁>>代碼示例>>Java>>正文


Java NumberKeyListener類代碼示例

本文整理匯總了Java中android.text.method.NumberKeyListener的典型用法代碼示例。如果您正苦於以下問題:Java NumberKeyListener類的具體用法?Java NumberKeyListener怎麽用?Java NumberKeyListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NumberKeyListener類屬於android.text.method包,在下文中一共展示了NumberKeyListener類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setKeyNull

import android.text.method.NumberKeyListener; //導入依賴的package包/類
private void setKeyNull(boolean isShow) {
	if(isShow == false){
   		if(oldKeyListener == null){
   			oldKeyListener = editText.getKeyListener();
   		}
   		
   		//確保瀏覽License時,能上下移動
   		editText.setKeyListener(new NumberKeyListener() {
   		    public int getInputType() {
   		        return InputType.TYPE_NULL;
   		    }

   		    protected char[] getAcceptedChars() {
   		        return new char[] {};
   		    }
   		});
   	}else{
   		if(oldKeyListener != null){
   			editText.setKeyListener(oldKeyListener);
   		}
   	}
}
 
開發者ID:javalovercn,項目名稱:j2se_for_android,代碼行數:23,代碼來源:JTextComponent.java

示例2: GeneratedPasswordView

import android.text.method.NumberKeyListener; //導入依賴的package包/類
public GeneratedPasswordView(Context context, AttributeSet attrs,
        int defStyle) {
    super(context, attrs, defStyle);

    super.setOnClickListener(this);

    setKeyListener(new NumberKeyListener() {
        public int getInputType() {
            return InputType.TYPE_NULL;
        }

        @Override
        protected char[] getAcceptedChars() {
            return new char[] {};
        }
    });
}
 
開發者ID:pdudits,項目名稱:supergenpass-android,代碼行數:18,代碼來源:GeneratedPasswordView.java

示例3: GeneratedPasswordView

import android.text.method.NumberKeyListener; //導入依賴的package包/類
public GeneratedPasswordView(final Context context, final AttributeSet attrs,
        final int defStyle) {
    super(context, attrs, defStyle);

    super.setOnClickListener(this);

    setKeyListener(new NumberKeyListener() {
        @Override
        public int getInputType() {
            return InputType.TYPE_NULL;
        }

        @NonNull
        @Override
        protected char[] getAcceptedChars() {
            return new char[] {};
        }
    });
}
 
開發者ID:xxv,項目名稱:SuperGenPass,代碼行數:20,代碼來源:GeneratedPasswordView.java

示例4: init

import android.text.method.NumberKeyListener; //導入依賴的package包/類
private void init(Context context) {
    setKeyListener(new NumberKeyListener() {
        @Override
        protected char[] getAcceptedChars() {
            return "1234567890,".toCharArray();
        }

        @Override
        public int getInputType() {
            return InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
        }
    });
}
 
開發者ID:tranleduy2000,項目名稱:sortalgorithm,代碼行數:14,代碼來源:EditTextInputArray.java

示例5: DosageResultView

import android.text.method.NumberKeyListener; //導入依賴的package包/類
public DosageResultView(Context context, AttributeSet attrs) {
    super(context, attrs);

    LayoutInflater inflater = LayoutInflater.from(context);
    inflater.inflate(R.layout.dosage_result_view, this, true);

    mEditText = (EditText) findViewById(R.id.dosage_result_edittext);
    mLabel = (TextView) findViewById(R.id.dosage_result_label);
    mUnitLabel = (TextView) findViewById(R.id.dosage_result_unit_label);

    // give EditText unique ID to prevent text duplication with other views
    mEditText.setId(ViewUtils.generateViewId());

    Button btnCopy = (Button) findViewById(R.id.btnCopy);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,          RelativeLayout.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.RIGHT_OF, mEditText.getId());
    params.addRule(RelativeLayout.ALIGN_BOTTOM, mEditText.getId());
    params.addRule(RelativeLayout.ALIGN_TOP, mEditText.getId());
    btnCopy.setLayoutParams(params);
    btnCopy.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            boolean result = ClipboardUtils.copyToClipboard(getContext(), String.format("%s %s",
                    mEditText.getText().toString(), mUnitLabel.getText().toString()));

            if (result)
                Toast.makeText(getContext(), "Dosage copied to clipboard", Toast.LENGTH_SHORT).show();
        }
    });

    mEditText.setKeyListener(new NumberKeyListener() {
        public int getInputType() {
            return InputType.TYPE_NULL;
        }

        protected char[] getAcceptedChars() {
            return new char[]{};
        }
    });
}
 
開發者ID:NateShoffner,項目名稱:Seachem-Doser,代碼行數:41,代碼來源:DosageResultView.java

示例6: setLogic

import android.text.method.NumberKeyListener; //導入依賴的package包/類
protected void setLogic(Logic logic) {
	mLogic = logic;
	NumberKeyListener calculatorKeyListener = new NumberKeyListener() {

		public int getInputType() {
			return EditorInfo.TYPE_CLASS_TEXT;
		}

		@Override
		protected char[] getAcceptedChars() {
			return chAccepted_chars;
		}

		@Override
		public CharSequence filter(CharSequence source, int inStart,
				int inEnd, Spanned dest, int inDstart, int inDend) {
			return null;
		}
	};

	Editable.Factory factory = new CalculatorEditable.Factory(logic);
	for (int i = 0; i < 2; ++i) {
		EditText etxtText = (EditText) getChildAt(i);
		etxtText.setBackgroundDrawable(null);
		etxtText.setEditableFactory(factory);
		etxtText.setKeyListener(calculatorKeyListener);
		etxtText.setSingleLine();
	}
}
 
開發者ID:cybro,項目名稱:PalmCalc,代碼行數:30,代碼來源:CalculatorDisplay.java


注:本文中的android.text.method.NumberKeyListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。