Java Code Examples for android.widget.EditText#setBackground()

The following examples show how to use android.widget.EditText#setBackground() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HyperTextEditor.java    From YCCustomText with Apache License 2.0 6 votes vote down vote up
/**
 * 添加生成文本输入框
 * @param hint								内容
 * @param paddingTop						到顶部高度
 * @return
 */
private EditText createEditText(String hint, int paddingTop) {
	EditText editText = new DeletableEditText(getContext());
	LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	editText.setLayoutParams(layoutParams);
	editText.setTextSize(16);
	editText.setTextColor(Color.parseColor("#616161"));
	editText.setCursorVisible(true);
	editText.setBackground(null);
	editText.setOnKeyListener(keyListener);
	editText.setOnFocusChangeListener(focusListener);
	editText.addTextChangedListener(textWatcher);
	editText.setTag(viewTagIndex++);
	editText.setPadding(editNormalPadding, paddingTop, editNormalPadding, paddingTop);
	editText.setHint(hint);
	editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, rtTextSize);
	editText.setTextColor(rtTextColor);
	editText.setHintTextColor(rtHintTextColor);
	editText.setLineSpacing(rtTextLineSpace, 1.0f);
	HyperLibUtils.setCursorDrawableColor(editText, cursorColor);
	return editText;
}
 
Example 2
Source File: CodeLineCellFactory.java    From DebugRank with Apache License 2.0 6 votes vote down vote up
@Override
public View createCellEditor(GridPanel gridPanel, GridCellRange cellRange, Rect bounds)
{
    EditText editText = (EditText) super.createCellEditor(gridPanel, cellRange, bounds);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
    {
        editText.setBackground(null);
    }

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
    {
        editText.setBackgroundTintMode(PorterDuff.Mode.CLEAR);
    }

    editText.setBackgroundColor(ContextCompat.getColor(flexGrid.getContext(), R.color.colorTransparent));

    return editText;
}
 
Example 3
Source File: VerificationCodeInput.java    From VerificationCodeInput with MIT License 5 votes vote down vote up
private void setBg(EditText editText, boolean focus) {
    if (boxBgNormal != null && !focus) {
        editText.setBackground(boxBgNormal);
    } else if (boxBgFocus != null && focus) {
        editText.setBackground(boxBgFocus);
    }
}
 
Example 4
Source File: PinViewBaseHelper.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set a PinBox with all attributes
 *
 * @param editText to set attributes
 */
private void setStylePinBox(EditText editText) {
    editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mNumberCharacters)});

    if (mMaskPassword) {
        editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }
    else{
        editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
    }

    if (mNativePinBox) {
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
            //noinspection deprecation
            editText.setBackgroundDrawable(new EditText(getContext()).getBackground());
        } else {
            editText.setBackground(new EditText(getContext()).getBackground());
        }
    } else {
        editText.setBackgroundResource(mCustomDrawablePinBox);
    }

    if (mColorTextPinBoxes != PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX) {
        editText.setTextColor(mColorTextPinBoxes);
    }
    editText.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mTextSizePinBoxes));
}
 
Example 5
Source File: PinViewBaseHelper.java    From PinView with Apache License 2.0 5 votes vote down vote up
/**
 * Set a PinBox with all attributes
 *
 * @param editText to set attributes
 */
private void setStylePinBox(EditText editText) {
    editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mNumberCharacters)});

    if (mMaskPassword) {
        editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }
    else{
        editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
    }

    if (mNativePinBox) {
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
            //noinspection deprecation
            editText.setBackgroundDrawable(new EditText(getContext()).getBackground());
        } else {
            editText.setBackground(new EditText(getContext()).getBackground());
        }
    } else {
        editText.setBackgroundResource(mCustomDrawablePinBox);
    }

    if (mColorTextPinBoxes != PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX) {
        editText.setTextColor(mColorTextPinBoxes);
    }
    editText.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mTextSizePinBoxes));
}