Java Code Examples for android.widget.TextView.setInputType()

The following are Jave code examples for showing how to use setInputType() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: https-github.com-hyb1996-NoRootScriptDroid   File: ConvertLayoutInflater.java   View Source Code Vote up 5 votes
@Override
public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
    if (!(view instanceof TextView))
        return;
    TextView textView = (TextView) view;
    String[] types = value.split("[|]");
    int inputType = 0;
    for (String type : types) {
        if (mInputTypes.containsKey(type)) {
            inputType |= mInputTypes.get(type);
        }
    }
    if (inputType != 0)
        textView.setInputType(inputType);
}
 
Example 2
Project: okwallet   File: CurrencyAmountView.java   View Source Code Vote up 5 votes
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    final Context context = getContext();

    textView = (TextView) getChildAt(0);
    textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    textView.setHintTextColor(lessSignificantColor);
    textView.setHorizontalFadingEdgeEnabled(true);
    textView.setSingleLine();
    setValidateAmount(textView instanceof EditText);
    textView.addTextChangedListener(textViewListener);
    textView.setOnFocusChangeListener(textViewListener);

    contextButton = new View(context) {
        @Override
        protected void onMeasure(final int wMeasureSpec, final int hMeasureSpec) {
            setMeasuredDimension(textView.getCompoundPaddingRight(), textView.getMeasuredHeight());
        }
    };
    final LayoutParams chooseViewParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    chooseViewParams.gravity = Gravity.RIGHT;
    contextButton.setLayoutParams(chooseViewParams);
    this.addView(contextButton);

    updateAppearance();
}
 
Example 3
Project: GitHub   File: NumberAddSubView.java   View Source Code Vote up 4 votes
private void initView(){



        View view = mInflater.inflate(R.layout.widet_num_add_sub,this,true);

        mEtxtNum = (TextView) view.findViewById(R.id.etxt_num);
        mEtxtNum.setInputType(InputType.TYPE_NULL);
        mEtxtNum.setKeyListener(null);



        mBtnAdd = (Button) view.findViewById(R.id.btn_add);
        mBtnSub = (Button) view.findViewById(R.id.btn_sub);

        mBtnAdd.setOnClickListener(this);
        mBtnSub.setOnClickListener(this);



    }
 
Example 4
Project: cniao5   File: NumberAddSubView.java   View Source Code Vote up 4 votes
private void initView() {


        View view = mInflater.inflate(R.layout.widet_num_add_sub, this, true);

        mEtxtNum = (TextView) view.findViewById(R.id.etxt_num);
        mEtxtNum.setInputType(InputType.TYPE_NULL);
        mEtxtNum.setKeyListener(null);


        mBtnAdd = (Button) view.findViewById(R.id.btn_add);
        mBtnSub = (Button) view.findViewById(R.id.btn_sub);

        mBtnAdd.setOnClickListener(this);
        mBtnSub.setOnClickListener(this);

    }
 
Example 5
Project: SuperRecyclerViewAdapter   File: SuperRecyclerHolder.java   View Source Code Vote up 4 votes
public SuperRecyclerHolder setInputType(@IdRes int viewId, int type) {
    TextView textView = retrieveView(viewId);
    textView.setInputType(type);
    return this;
}