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

The following examples show how to use android.widget.TextView#setHorizontallyScrolling() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: commcare-android   File: ListWidget.java    License: Apache License 2.0 6 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 Project: memoir   File: SpinnerItemAdapter.java    License: 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 Project: memoir   File: SpinnerItemAdapter.java    License: 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
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 Project: commcare-android   File: QuestionsView.java    License: 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 Project: commcare-android   File: LabelWidget.java    License: 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
@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 Project: commcare-android   File: QuestionWidget.java    License: 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 Project: memoir   File: SpinnerItem.java    License: 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 Project: memoir   File: SpinnerItem.java    License: 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 Project: Android-RTEditor   File: SpinnerItem.java    License: 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 Project: quill   File: PostEditFragment.java    License: 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 Project: Onosendai   File: ExecutorStatus.java    License: 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);
}