/** * Makes the TextView at most this many lines tall. * * Setting this value overrides any other (maximum) height setting. * * @attr ref android.R.styleable#TextView_maxLines */ public void setMaxLines (int maxlines){ mInputView.setMaxLines(maxlines); }
@Override public void setMaxLines(int maxLines) { super.setMaxLines(maxLines); this.maxLines = maxLines; adjustTextSize(); }
@Override public void setSingleLine(boolean singleLine) { super.setSingleLine(singleLine); if (!singleLine) super.setMaxLines(-1); adjustTextSize(); }
inputType |= EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE; editText.setMinLines(minLines); editText.setMaxLines(maxLines); } else { inputType &= ~EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
mEdit.setMaxLines(mBuilder.getMaxLines());
editText.setEllipsize(ellipsize); editText.setMinLines(minLines); editText.setMaxLines(maxLines); editText.setShadowLayer(shadowRadius, shadowDx, shadowDy, shadowColor); editText.setLinkTextColor(linkColor);
EditText edText = new EditText(this); edText .setId(i); edText .setLayoutParams(new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)); edText .setWidth(100); edText .setImeOptions(EditorInfo.IME_ACTION_NEXT); edText .setInputType(InputType.TYPE_CLASS_NUMBER); edText .setKeyListener(DigitsKeyListener.getInstance()); edText .setMaxLines(1); edText .setOnFocusChangeListener(this); edText .setOnEditorActionListener(this); edText .addTextChangedListener(this); //this linearlayout id is declared inside your xml file LinearLayout linear=(LinearLayout)findViewById(R.id.linearLayout1); linear.addView(edText );
public void setMaxLine(int maxLine) { this.maxLine = maxLine; editText.setMaxLines(this.maxLine); }
/** * Delegate method for {@link EditText#setMaxLines(int)}. * @see android.R.attr#maxLines android:maxLines * @see #getMaxLines() */ public void setMaxLines(int maxLines) { if (mEditConfig.maxLines != maxLines) { mEditConfig.maxLines = Math.max(0, maxLines); if (mEditText != null) mEditText.setMaxLines(mEditConfig.maxLines); } }
/** * Delegate method for {@link EditText#setMaxLines(int)}. * @see android.R.attr#maxLines android:maxLines * @see #getMaxLines() */ public void setMaxLines(int maxLines) { if (mEditConfig.maxLines != maxLines) { mEditConfig.maxLines = Math.max(0, maxLines); if (mEditText != null) mEditText.setMaxLines(mEditConfig.maxLines); } }
@Override public void setMaxLines(final int maxlines) { super.setMaxLines(maxlines); _maxLines = maxlines; reAdjust(); }
GeekyView() { super(RecurrenceFrequency.GEEKY); geekyEditText.setText("FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13"); geekyEditText.setMinLines(3); geekyEditText.setMaxLines(5); }
EditText et = new EditText(this); empty.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); et.setText("Dynamic EditText!"); et.setMinLines(1); et.setMaxLines(3); relativelayout.addView(et); // assuming you already have your relative layout and the rest declared.
EditText text2 = new EditText(context); text2.setText("Test"); text2 .setLayoutParams(new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)); text2 .setWidth(100); text2 .setMaxLines(1); this.addView(text2);
AlertDialog.Builder alertDialog = new AlertDialog.Builder(mainActivity); alertDialog.setTitle("Enter Date"); final EditText input = new EditText(mainActivity); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(left, top, right, bottom); input.setLayoutParams(lp); input.setGravity(android.view.Gravity.TOP|android.view.Gravity.LEFT); input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES|InputType.TYPE_TEXT_FLAG_MULTI_LINE); input.setLines(1); input.setMaxLines(1); input.setText(lastDateValue); alertDialog.setView(input);
TableRow r1 = new TableRow(this); r1 .setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); final float scale = this.getResources().getDisplayMetrics().density; TextView editLabel = new TextView(this); editLabel.setLayoutParams(new TableRow.LayoutParams(0, TableRow.LayoutParams.WRAP_CONTENT,(int) (1 * scale + 0.5f))); editLabel.setText("Label"); EditText editText = new EditText(this); editText.setLayoutParams(new TableRow.LayoutParams(0, TableRow.LayoutParams.WRAP_CONTENT,(int) (1 * scale + 0.5f))); editText.setMaxLines(1); r1.addView(editLabel); r1.addView(editText); tableLayout1.addView(r1);
EditText editText = new EditText(this); editText.setId(1); editText.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,0f)); editText.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); editText.setGravity(Gravity.TOP|Gravity.LEFT); editText.setHint("Comment"); editText.setSingleLine(false); editText.setLines(5); editText.setMaxLines(5); editText.setText(CommentFromDB); editTextRemark.setFocusable(false);
EditText yourEditText = new EditText(context); yourEditText.setScroller(new Scroller(context)); yourEditText.setMaxLines(1); yourEditText.setVerticalScrollBarEnabled(true); yourEditText.setMovementMethod(new ScrollingMovementMethod());
EditText testEdit1= new EditText(this); testEdit1.setVerticalScrollBarEnabled(true); testEdit1.setBackgroundResource(R.drawable.black_rect_border); testEdit1.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); testEdit1.setLines(5); testEdit1.setSingleLine(false); testEdit1.setMaxLines(5); testEdit1.setGravity(Gravity.TOP|Gravity.LEFT); testEdit1.setId(unusedid); unusedid++; testEdit1.setTextSize(16); testEdit1.setLayoutParams(bigedit);
private void setDefault(EditText editText) { editText.setMaxLines(1); if (mTextSize != 0) { editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); } editText.setTextColor(mTextColor); if (mTextCursorDrawable != -1) { Utils.setTextCursorDrawable(editText, mTextCursorDrawable); } editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mMaxLength)}); editText.setGravity(Gravity.CENTER); editText.setMinWidth(mMinWidth); editText.setMinHeight(mMinHeight); editText.setGravity(mGravity); editText.setInputType(mInputType); }