Java Code Examples for android.widget.TextView#setHorizontallyScrolling()

The following examples show how to use android.widget.TextView#setHorizontallyScrolling() . 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: ListWidget.java    From commcare-android with Apache License 2.0 7 votes vote down vote up
@Override
protected void addQuestionText() {
    // Add the text view. Textview always exists, regardless of whether there's text.
    TextView questionText = new TextView(getContext());
    setQuestionText(questionText, mPrompt);
    questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXTSIZE);
    questionText.setTypeface(null, Typeface.BOLD);
    questionText.setPadding(0, 0, 0, 7);
    questionText.setId(buttonIdBase); // assign random id

    // Wrap to the size of the parent view
    questionText.setHorizontallyScrolling(false);

    if (mPrompt.getLongText() == null) {
        questionText.setVisibility(GONE);
    }

    // Put the question text on the left half of the screen
    LinearLayout.LayoutParams labelParams =
            new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    labelParams.weight = 1;

    questionLayout = new LinearLayout(getContext());
    questionLayout.setOrientation(LinearLayout.HORIZONTAL);
    questionLayout.addView(questionText, labelParams);
}
 
Example 2
Source File: SpinnerItemAdapter.java    From memoir with Apache License 2.0 5 votes vote down vote up
private void updateSpinnerTitle(TextView titleView) {
    if (titleView != null) {
        titleView.setText(mSpinnerTitle);
        titleView.setVisibility((mSpinnerTitle == null) ? View.GONE : View.VISIBLE);
        titleView.setHorizontallyScrolling(true);
    }
}
 
Example 3
Source File: SpinnerItemAdapter.java    From memoir with Apache License 2.0 5 votes vote down vote up
private void updateSpinnerTitle(TextView titleView) {
    if (titleView != null) {
        titleView.setText(mSpinnerTitle);
        titleView.setVisibility((mSpinnerTitle == null) ? View.GONE : View.VISIBLE);
        titleView.setHorizontallyScrolling(true);
    }
}
 
Example 4
Source File: SpinnerItemAdapter.java    From Android-RTEditor with Apache License 2.0 5 votes vote down vote up
private void updateSpinnerTitle(TextView titleView) {
    if (titleView != null) {
        titleView.setText(mSpinnerTitle);
        titleView.setVisibility((mSpinnerTitle == null) ? View.GONE : View.VISIBLE);
        titleView.setHorizontallyScrolling(true);
    }
}
 
Example 5
Source File: QuestionsView.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
private void addHintText(String hintText) {
    if (hintText != null && !hintText.equals("")) {
        TextView mHelpText = new TextView(getContext());
        mHelpText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize - 3);
        mHelpText.setPadding(0, -5, 0, 7);
        // wrap to the widget of view
        mHelpText.setHorizontallyScrolling(false);
        mHelpText.setText(hintText);
        mHelpText.setTypeface(null, Typeface.ITALIC);

        mViewBannerCount++;
        mView.addView(mHelpText, mLayout);
    }
}
 
Example 6
Source File: LabelWidget.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void addQuestionText() {
    // Add the text view. Textview always exists, regardless of whether there's text.
    mQuestionText = new TextView(getContext());
    setQuestionText(mQuestionText, mPrompt);
    mQuestionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXTSIZE);
    mQuestionText.setTypeface(null, Typeface.BOLD);
    mQuestionText.setPadding(0, 0, 0, 7);
    mQuestionText.setId(RANDOM_BUTTON_ID); // assign random id

    // Wrap to the size of the parent view
    mQuestionText.setHorizontallyScrolling(false);

    if (mPrompt.getLongText() == null) {
        mQuestionText.setVisibility(GONE);
    }

    // Put the question text on the left half of the screen
    LinearLayout.LayoutParams labelParams =
            new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    labelParams.weight = 1;

    questionLayout = new LinearLayout(getContext());
    questionLayout.setOrientation(LinearLayout.HORIZONTAL);

    questionLayout.addView(mQuestionText, labelParams);
}
 
Example 7
Source File: ListMultiWidget.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void addQuestionText() {
    // Add the text view. Textview always exists, regardless of whether there's text.
    TextView questionText = new TextView(getContext());
    setQuestionText(questionText, mPrompt);
    questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXTSIZE);
    questionText.setTypeface(null, Typeface.BOLD);
    questionText.setPadding(0, 0, 0, 7);
    questionText.setId(buttonIdBase); // assign random id

    // Wrap to the size of the parent view
    questionText.setHorizontallyScrolling(false);

    if (mPrompt.getLongText() == null) {
        questionText.setVisibility(GONE);
    }

    // Put the question text on the left half of the screen
    LinearLayout.LayoutParams labelParams =
            new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    labelParams.weight = 1;

    questionLayout = new LinearLayout(getContext());
    questionLayout.setOrientation(LinearLayout.HORIZONTAL);

    questionLayout.addView(questionText, labelParams);
}
 
Example 8
Source File: QuestionWidget.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
public void setQuestionText(TextView textView, FormEntryPrompt prompt) {
    textView.setText(getTextFromPrompt(prompt));
    if (prompt.getMarkdownText() != null) {
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        // Wrap to the size of the parent view
        textView.setHorizontallyScrolling(false);
    }
}
 
Example 9
Source File: SpinnerItem.java    From memoir with Apache License 2.0 4 votes vote down vote up
void formatNameView(TextView view) {
    if (view != null) {
        view.setText(getName());
        view.setHorizontallyScrolling(true);
    }
}
 
Example 10
Source File: SpinnerItem.java    From memoir with Apache License 2.0 4 votes vote down vote up
void formatNameView(TextView view) {
    if (view != null) {
        view.setText(getName());
        view.setHorizontallyScrolling(true);
    }
}
 
Example 11
Source File: SpinnerItem.java    From Android-RTEditor with Apache License 2.0 4 votes vote down vote up
void formatNameView(TextView view) {
    if (view != null) {
        view.setText(getName());
        view.setHorizontallyScrolling(true);
    }
}
 
Example 12
Source File: PostEditFragment.java    From quill with MIT License 4 votes vote down vote up
public void onInsertImageUrlClicked(Action1<String> resultAction) {
    // ok to pass null here: https://possiblemobile.com/2013/05/layout-inflation-as-intended/
    @SuppressLint("InflateParams")
    final View dialogView = mActivity.getLayoutInflater().inflate(R.layout.dialog_image_insert,
            null, false);
    final TextView imageUrlView = (TextView) dialogView.findViewById(R.id.image_url);

    // hack for word wrap with "Done" IME action! see http://stackoverflow.com/a/13563946/504611
    imageUrlView.setHorizontallyScrolling(false);
    imageUrlView.setMaxLines(20);

    Observable<String> imageUrlObservable = Observables.getDialog(emitter -> {
        AlertDialog dialog = new AlertDialog.Builder(mActivity)
                .setTitle(mActivity.getString(R.string.insert_image))
                .setView(dialogView)
                .setCancelable(true)
                .setPositiveButton(R.string.insert, (d, which) -> {
                    emitter.onNext(imageUrlView.getText().toString());
                    emitter.onComplete();
                })
                .setNegativeButton(android.R.string.cancel, (d, which) -> {
                    d.dismiss();
                    emitter.onComplete();
                })
                .create();
        imageUrlView.setOnEditorActionListener((view, actionId, event) -> {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
                return true;
            }
            return false;
        });
        return dialog;
    });

    imageUrlObservable.subscribe((imageUrl) -> {
        resultAction.call(imageUrl);
        mMarkdownEditSelectionState = null;
        KeyboardUtils.focusAndShowKeyboard(mActivity, mPostEditView);
    });
}
 
Example 13
Source File: ExecutorStatus.java    From Onosendai with Apache License 2.0 4 votes vote down vote up
public ExecutorStatus (final TextView textView) {
	this.textView = textView;
	textView.setHorizontallyScrolling(true);
	textView.setEllipsize(null);
	this.refreshUiHandler = new RefreshUiHandler(this);
}