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