@Override public void setBackground(Drawable background) { if (background != null) { background.mutate(); } super.setBackground(background); } }
editText.setBackgroundDrawable(background); } else { editText.setBackground(background);
@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; } }
if (backgroundResourceId == 0) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { mEditText.setBackground(new InputDrawable(mInputParams.strokeWidth, mInputParams .strokeColor, mInputParams.inputBackgroundColor)); } else {
@Override public void setBackground(Drawable background) { super.setBackground(background); if (mBackgroundHelper != null) { mBackgroundHelper.setBackgroundDrawableExternal(background); } }
@Override public void onTransitionStart(Transition transition) { InputMethodManager imm = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(etPhoneNo.getWindowToken(), 0); tvMoving.setText(null); tvMoving.setHint(getString(R.string.enter_no)); ivFlag.setImageAlpha(0); tvCode.setAlpha(0); etPhoneNo.setVisibility(View.GONE); etPhoneNo.setCursorVisible(false); etPhoneNo.setBackground(null); Animation animation = AnimationUtils.loadAnimation(LoginWithPhone.this, R.anim.slide_left); ivBack.startAnimation(animation); }
private void setBg(EditText editText, boolean focus) { if (boxBgNormal != null && !focus) { editText.setBackground(boxBgNormal); } else if (boxBgFocus != null && focus) { editText.setBackground(boxBgFocus); } }
private void resetPassphraseBoxColor() { mPassphraseEditText.setBackground(mOriginalBackground); } }
/** * Notify this fragment that the passphrase the user entered is incorrect. */ private void invalidPassphrase() { mVerifyingTextView.setText(R.string.sync_passphrase_incorrect); mVerifyingTextView.setTextColor(ApiCompatibilityUtils.getColor(getResources(), R.color.input_underline_error_color)); mPassphraseEditText.setBackground(mErrorBackground); }
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public Dialog getDialog(Context context) { final EditText editText = new EditText(context); editText.setBackground(null); editText.setPadding(60, 40, 0, 0); AlertDialog.Builder builder = new AlertDialog.Builder(context, INSERT_THEME); builder.setTitle(title); builder.setView(editText); builder.setPositiveButton(DIALOG_POSITIVE, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(resultListener != null){ resultListener.onDataResult(editText.getText().toString()); } } }); builder.setNegativeButton(DIALOG_NEGATIVE, null); return builder.create(); } }, cancelable, null);
txtTitle.setBackground(null);
public void init(final Context context) { LinearLayout layout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.card, null); layout.setLayoutParams(new LinearLayout.LayoutParams(ScreenSizeUtil.Dp2Px(getContext(), 285), LayoutParams.WRAP_CONTENT)); layout.setLayerType(View.LAYER_TYPE_SOFTWARE, null);//没有这句不显示 topLayout = (RelativeLayout) layout.findViewById(R.id.top); centerLayout = (ImageView) layout.findViewById(R.id.center); content = (TextView) layout.findViewById(R.id.content); comment = (EditText) layout.findViewById(R.id.comment); myGrad = (GradientDrawable) content.getBackground(); topDrawable = new TopDrawable(); topLayout.setBackground(topDrawable); centerDrawable = new CenterDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.quote)); centerLayout.setBackground(centerDrawable); bottomDrawable = new BottomDrawable(); comment.setBackground(bottomDrawable); addView(layout); }
dueAmountText.setBackground(drawable); // set the new drawable to EditText
etInput.setBackground(contentBackground);
/** * Super gross, dirty, awful hack for dealing with bugs in version 23 of the support library. * * Gleaned using dirty things from comments on the Android bug and support library source: * https://code.google.com/p/android/issues/detail?id=190829 */ @Override public void setError(@Nullable CharSequence error) { if (!mIsBackgroundMutated && getEditText() != null && getEditText().getBackground() != null && ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP))) { getEditText().setBackground( getEditText().getBackground().getConstantState().newDrawable()); getEditText().getBackground().mutate(); mIsBackgroundMutated = true; } super.setError(error); if (TextUtils.isEmpty(error)) setErrorEnabled(false); }
editTxt.setHint(sHint); editTxt.setContentDescription(1+""); editTxt.setBackground( getResources().getDrawable(R.drawable.rcornerx)); editTxt.setGravity(Gravity.CENTER); editTxt.setTextColor(Color.WHITE);