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

The following examples show how to use android.widget.EditText#setVerticalScrollBarEnabled() . 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: NativeElementView.java    From htmlview with Apache License 2.0 5 votes vote down vote up
static NativeElementView createTextArea(final Context context, final Element element) {
  int textSize = element.getScaledPx(Style.FONT_SIZE);
  EditText editText = new EditText(context);
  editText.setSingleLine(false);
  editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
  editText.setGravity(Gravity.TOP);
  // TODO: Calculate lines based on height if fixed.
  editText.setLines(element.getAttributeInt("rows", 2));
  editText.setVerticalScrollBarEnabled(true);
  LayoutParams params = new LayoutParams(0, LayoutParams.WRAP_CONTENT);
  editText.setLayoutParams(params);
  NativeElementView result = new NativeElementView(context, element, false, editText);
  result.reset();
  return result;
}
 
Example 2
Source File: BblContentFragment.java    From BubbleAlert with MIT License 4 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    clickHandler = new ClickHandler(this);

    txtDialogTitle = (TextView) view.findViewById(R.id.txtDialogTitle);
    txtContent = (TextView) view.findViewById(R.id.txtContent);
    btnOk = (TextView) view.findViewById(R.id.btnOk);
    btnExit = (TextView) view.findViewById(R.id.btnExit);
    btnCancel = (TextView) view.findViewById(R.id.btnCancel);
    edtLibName = (EditText) view.findViewById(R.id.edtLibName);

    btnOk.setOnClickListener(clickHandler);
    btnExit.setOnClickListener(clickHandler);
    btnCancel.setOnClickListener(clickHandler);

    txtContent.setText(content);
    btnOk.setText(ok);
    btnCancel.setText(cancel);
    btnExit.setText(exit);
    if (!TextUtils.isEmpty(sDialogTitle)) {
        txtDialogTitle.setText(sDialogTitle);
    }

    if (btnCount == 1) {
        btnCancel.setVisibility(View.GONE);
    } else if (btnCount == 3) {
        btnExit.setVisibility(View.VISIBLE);
    }

    int visibility = hasEditText ? View.VISIBLE : View.GONE;

    edtLibName.setVisibility(visibility);
    if (!TextUtils.isEmpty(textContent)) {

        edtLibName.setText(textContent);
    }

    if (!TextUtils.isEmpty(hintText)) {

        edtLibName.setHint(hintText);
    }

    if (isMultiLineEditText) {
        edtLibName.setMaxLines(1);
        edtLibName.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
        edtLibName.setScroller(new Scroller(getContext()));
        edtLibName.setVerticalScrollBarEnabled(true);
        edtLibName.setMovementMethod(new ScrollingMovementMethod());
    }

}