Example usage for android.widget TextView setHorizontallyScrolling

List of usage examples for android.widget TextView setHorizontallyScrolling

Introduction

In this page you can find the example usage for android.widget TextView setHorizontallyScrolling.

Prototype

public void setHorizontallyScrolling(boolean whether) 

Source Link

Document

Sets whether the text should be allowed to be wider than the View is.

Usage

From source file:com.mods.grx.settings.utils.Utils.java

public static void animate_textview_marquee(TextView textView) {
    textView.setTextIsSelectable(true);//from  www . j ava  2 s. c o m
    textView.setSingleLine(true);
    textView.setHorizontallyScrolling(true);
    textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    textView.setMarqueeRepeatLimit(1);
}

From source file:com.mods.grx.settings.utils.Utils.java

public static void animate_textview_marquee_forever(TextView textView) {
    textView.setTextIsSelectable(true);/*from  w  w w. ja v  a  2 s . co  m*/
    textView.setSingleLine(true);
    textView.setHorizontallyScrolling(true);
    textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);

}

From source file:com.example.samsungmdm.MainActivity.java

public void onServerResponse(String response) {
    TextView serverResponseTextView = new TextView(this);
    serverResponseTextView.setHorizontallyScrolling(true);
    serverResponseTextView.setSingleLine();
    serverResponseTextView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    serverResponseTextView.setFocusableInTouchMode(true);
    serverResponseTextView.setMarqueeRepeatLimit(1);
    serverResponseTextView.setFocusable(true);
    String myTime = java.text.DateFormat.getTimeInstance().format(Calendar.getInstance().getTime());
    serverResponseTextView.setText(myTime + " - " + response);

    mServerResponseLinearLayout.addView(serverResponseTextView, 0);

    //Parsing server response
    try {/*from   w  ww . ja  v  a2 s  . c o  m*/
        parseServerResponse(new JSONObject(response));
    } catch (JSONException e) {
        Log.e(TAG, "Invalid JSON response from the server");
        e.printStackTrace();
    }
}

From source file:org.alfresco.mobile.android.application.fragments.signin.WelcomeFragment.java

private void displayError(String errorMessage) {
    hide(R.id.homescreen_config_progress);
    hide(R.id.homescreen_config_message);
    show(R.id.homescreen_config_error);//from w ww  .ja  va  2  s.c om

    TextView txt = (TextView) viewById(R.id.homescreen_config_error);
    txt.setText(
            Html.fromHtml(String.format(getString(R.string.error_mdm_loading_configuration), errorMessage)));
    HolderUtils.makeMultiLine(txt, 5);
    txt.setHorizontallyScrolling(false);
}

From source file:org.odk.collect.android.widgets.QuestionWidget.java

private TextView createHelpText(FormEntryPrompt prompt) {
    TextView helpText = new TextView(getContext());
    String s = prompt.getHelpText();

    if (s != null && !s.equals("")) {
        helpText.setId(ViewIds.generateViewId());
        helpText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, questionFontsize - 3);
        //noinspection ResourceType
        helpText.setPadding(0, -5, 0, 7);
        // wrap to the widget of view
        helpText.setHorizontallyScrolling(false);
        helpText.setTypeface(null, Typeface.ITALIC);
        helpText.setText(TextUtils.textToHtml(s));
        helpText.setTextColor(ContextCompat.getColor(getContext(), R.color.primaryTextColor));
        helpText.setMovementMethod(LinkMovementMethod.getInstance());
        return helpText;
    } else {//w w  w . ja  va 2 s  .c o m
        helpText.setVisibility(View.GONE);
        return helpText;
    }
}

From source file:org.odk.collect.android.widgets.QuestionWidget.java

private MediaLayout createQuestionMediaLayout(FormEntryPrompt prompt) {
    String promptText = prompt.getLongText();
    // Add the text view. Textview always exists, regardless of whether there's text.
    TextView questionText = new TextView(getContext());
    questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, questionFontsize);
    questionText.setTypeface(null, Typeface.BOLD);
    questionText.setTextColor(ContextCompat.getColor(getContext(), R.color.primaryTextColor));
    questionText.setPadding(0, 0, 0, 7);
    questionText.setText(promptText == null ? "" : TextUtils.textToHtml(promptText));
    questionText.setMovementMethod(LinkMovementMethod.getInstance());

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

    if (promptText == null || promptText.length() == 0) {
        questionText.setVisibility(GONE);
    }//from   w w  w  . j ava2s .  co m

    String imageURI = prompt.getImageText();
    String audioURI = prompt.getAudioText();
    String videoURI = prompt.getSpecialFormQuestionText("video");

    // shown when image is clicked
    String bigImageURI = prompt.getSpecialFormQuestionText("big-image");

    // Create the layout for audio, image, text
    MediaLayout questionMediaLayout = new MediaLayout(getContext(), player);
    questionMediaLayout.setId(ViewIds.generateViewId()); // assign random id
    questionMediaLayout.setAVT(prompt.getIndex(), "", questionText, audioURI, imageURI, videoURI, bigImageURI);
    questionMediaLayout.setAudioListener(this);

    String playColorString = prompt.getFormElement().getAdditionalAttribute(null, "playColor");
    if (playColorString != null) {
        try {
            playColor = Color.parseColor(playColorString);
        } catch (IllegalArgumentException e) {
            Timber.e(e, "Argument %s is incorrect", playColorString);
        }
    }
    questionMediaLayout.setPlayTextColor(playColor);

    String playBackgroundColorString = prompt.getFormElement().getAdditionalAttribute(null,
            "playBackgroundColor");
    if (playBackgroundColorString != null) {
        try {
            playBackgroundColor = Color.parseColor(playBackgroundColorString);
        } catch (IllegalArgumentException e) {
            Timber.e(e, "Argument %s is incorrect", playBackgroundColorString);
        }
    }
    questionMediaLayout.setPlayTextBackgroundColor(playBackgroundColor);

    return questionMediaLayout;
}