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


Java EditText.setRawInputType方法代码示例

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


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

示例1: NumberPicker

import android.widget.EditText; //导入方法依赖的package包/类
public NumberPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);
    setOrientation(VERTICAL);
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.number_picker, this, true);
    mHandler = new Handler();
    InputFilter inputFilter = new NumberPickerInputFilter();
    mNumberInputFilter = new NumberRangeKeyListener();
    mIncrementButton = (NumberPickerButton) findViewById(R.id.increment);
    mIncrementButton.setOnClickListener(this);
    mIncrementButton.setOnLongClickListener(this);
    mIncrementButton.setNumberPicker(this);
    mDecrementButton = (NumberPickerButton) findViewById(R.id.decrement);
    mDecrementButton.setOnClickListener(this);
    mDecrementButton.setOnLongClickListener(this);
    mDecrementButton.setNumberPicker(this);
    
    mText = (EditText) findViewById(R.id.timepicker_input);
    mText.setOnFocusChangeListener(this);
    mText.setFilters(new InputFilter[] {inputFilter});
    mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);

    if (!isEnabled()) {
        setEnabled(false);
    }
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:27,代码来源:NumberPicker.java

示例2: onCreate

import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_anagrams);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    AssetManager assetManager = getAssets();
    try {
        InputStream inputStream = assetManager.open("words.txt");
        dictionary = new AnagramDictionary(new InputStreamReader(inputStream));
    } catch (IOException e) {
        Toast toast = Toast.makeText(this, "Could not load dictionary", Toast.LENGTH_LONG);
        toast.show();
    }
    // Set up the EditText box to process the content of the box when the user hits 'enter'
    final EditText editText = (EditText) findViewById(R.id.editText);
    editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
    editText.setImeOptions(EditorInfo.IME_ACTION_GO);
    editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_GO) {
                processWord(editText);
                handled = true;
            }
            return handled;
        }
    });
}
 
开发者ID:sugandha31,项目名称:Anagram,代码行数:31,代码来源:AnagramsActivity.java

示例3: NumberPicker

import android.widget.EditText; //导入方法依赖的package包/类
@SuppressWarnings({"UnusedDeclaration"})
public NumberPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);
    setOrientation(VERTICAL);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.number_picker, this, true);
    mHandler = new Handler();
    InputFilter inputFilter = new NumberPickerInputFilter();
    mNumberInputFilter = new NumberRangeKeyListener();
    mIncrementButton = (NumberPickerButton) findViewById(R.id.increment);
    mIncrementButton.setOnClickListener(this);
    mIncrementButton.setOnLongClickListener(this);
    mIncrementButton.setNumberPicker(this);
    mDecrementButton = (NumberPickerButton) findViewById(R.id.decrement);
    mDecrementButton.setOnClickListener(this);
    mDecrementButton.setOnLongClickListener(this);
    mDecrementButton.setNumberPicker(this);

    mText = (EditText) findViewById(R.id.timepicker_input);
    mText.setOnFocusChangeListener(this);
    //mText.setFilters(new InputFilter[] {inputFilter});
    mText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);

    if (!isEnabled()) {
        setEnabled(false);
    }
    
	TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.numberpicker );
	mStart = a.getInt( R.styleable.numberpicker_startRange, DEFAULT_MIN );
	mEnd = a.getInt( R.styleable.numberpicker_endRange, DEFAULT_MAX );
	mWrap = a.getBoolean( R.styleable.numberpicker_wrap, DEFAULT_WRAP );
	mCurrent = 	a.getInt( R.styleable.numberpicker_defaultValue, DEFAULT_VALUE );
	mCurrent = Math.max( mStart, Math.min( mCurrent, mEnd ) );
	mText.setText( "" + mCurrent );
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:36,代码来源:NumberPicker.java

示例4: setDeposit

import android.widget.EditText; //导入方法依赖的package包/类
private void setDeposit(SlotRoomViewModel viewModel) {
    Context context = MainApplication.getContext();

    EditText editText = new EditText(context);
    editText.setTextColor(ContextCompat.getColor(context, R.color.pink1));
    editText.getBackground().setColorFilter(context.getResources().getColor(R.color.pink1), PorterDuff.Mode.SRC_ATOP);
    editText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.leftMargin = context.getResources().getDimensionPixelSize(R.dimen.input_deposite_margin);
    params.rightMargin = context.getResources().getDimensionPixelSize(R.dimen.input_deposite_margin);
    editText.setLayoutParams(params);

    FrameLayout container = new FrameLayout(context);
    container.addView(editText);

    AlertDialog dialog = new AlertDialog.Builder(fragment.getActivity())
            .setView(container)
            .setTitle("DEPOSIT")
            .setMessage("Please write down the amount of ETH to put in this slot. Leave a certain amount of gas fee for the game. (at least 0.5 ETH)")
            .setPositiveButton("Confirm", (dialogInterface, i) -> {
                if (Utils.isEmpty(editText.getText())) {
                    Utils.showDialog(fragment.getActivity(), null, "Please enter the enough ETH.", "ok");
                    return;
                }
                deposit = Double.parseDouble(editText.getText().toString());

                AccountProvider.getBalance()
                        .subscribe(balance -> {
                            double playerBalance = Convert.fromWei(balance, Convert.Unit.ETHER).doubleValue();
                            if (deposit > playerBalance - 0.5) {
                                Utils.showDialog(fragment.getActivity(), "Insufficient Balance", "deposit amount exceeds balance + 0.5(ETH) gas fee.", "ok");
                                return;
                            }
                            enterSlotRoom(viewModel);
                        }, Throwable::printStackTrace);
            })
            .setNegativeButton("Cancel", null)
            .create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    dialog.show();
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:44,代码来源:SlotListAdapter.java


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