/** * Sets whether the text should be allowed to be wider than the * View is. If false, it will be wrapped to the width of the View. * * @attr ref android.R.styleable#TextView_scrollHorizontally */ public void setHorizontallyScrolling (boolean whether){ mInputView.setHorizontallyScrolling(whether); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.file_edit); setTitle(""); mCmdSave = (Button) findViewById(R.id.cmdSave); mFileEditText = (EditText) findViewById(R.id.fileText); mFileEditText.setHorizontallyScrolling(true); if (getIntent() != null && getIntent().getExtras() != null && getIntent().getExtras().getString(KEY_FILEPATH) != null) { mPath = getFilesDir().getAbsolutePath() + getIntent().getExtras().getString(KEY_FILEPATH); mFileEditText.setText(loadFile(mPath)); } mCmdSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mPath != null) saveFile(mFileEditText.getText().toString(), mPath); } }); }
editText.setHorizontallyScrolling(false);
EditText edit = new EditText(this); edit.setHorizontallyScrolling(true); edit.setInputType(EditorInfo.TYPE_NUMBER_FLAG_SIGNED|EditorInfo.TYPE_CLASS_NUMBER);
EditText editText = (EditText) findViewById(R.id.some_edittext); editText.setHorizontallyScrolling(true); editText.setMovementMethod(new ScrollingMovementMethod());
holder.local_text.setHorizontallyScrolling(false); holder.local_text.setMaxLines(100);
holder.local_text.setHorizontallyScrolling(false); holder.local_text.setMaxLines(100);
mAnswer.setHorizontallyScrolling(false); mAnswer.setSingleLine(false);
private EditText mEditText; private HorizontalScrollView mScrollView; private void init() { mEditText = (EditText) findViewById(R.id.TEXT_STATUS_ID); mScrollView = (HorizontalScrollView) findViewById(R.id.SCROLLER_ID); // loadDoc(); String s = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + "Aliquam tempus convallis metus, ac congue dui elementum ut." + "Suspendisse rutrum non sapien feugiat fermentum." + "Phasellus vulputate quam in sapien vulputate venenatis." + "Pellentesque porta tincidunt nisi, et scelerisque augue facilisis nec." + "Curabitur eget risus quam." + "Maecenas pellentesque egestas enim, in ornare nisl lobortis id." + "Nunc vitae facilisis libero, vitae porttitor tellus."; mEditText.setText(s); scrollToBottom(); } private void scrollToBottom() { mScrollView.post(new Runnable() { public void run() { mEditText.setHorizontallyScrolling(true); mEditText.setMovementMethod(new ScrollingMovementMethod()); mScrollView.smoothScrollTo(0, mEditText.getBottom()); } }); }
public IntegerWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride) { super(context, prompt, readOnlyOverride, true); mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED); // needed to make long readonly text scroll mAnswer.setHorizontallyScrolling(false); mAnswer.setSingleLine(false); // only allows numbers and no periods mAnswer.setKeyListener(new DigitsKeyListener(true, false)); // ints can only hold 2,147,483,648. we allow 999,999,999 InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(9); mAnswer.setFilters(fa); if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } Integer i = getIntegerAnswerValue(); if (i != null) { mAnswer.setText(i.toString()); } setupChangeListener(); }
mAnswer.setHorizontallyScrolling(false); mAnswer.setSingleLine(false);
public StringNumberWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride) { super(context, prompt, readOnlyOverride, true); mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED); // needed to make long readonly text scroll mAnswer.setHorizontallyScrolling(false); mAnswer.setSingleLine(false); mAnswer.setKeyListener(new DigitsKeyListener() { @Override protected char[] getAcceptedChars() { char[] accepted = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-', '+', ' ', ',' }; return accepted; } }); if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } String s = null; if (prompt.getAnswerValue() != null) s = (String) prompt.getAnswerValue().getValue(); if (s != null) { mAnswer.setText(s); } setupChangeListener(); }
mAnswer.setHorizontallyScrolling(false); mAnswer.setSingleLine(false);