当前位置: 首页>>代码示例>>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;未经允许,请勿转载。