Example usage for android.widget TextView setSingleLine

List of usage examples for android.widget TextView setSingleLine

Introduction

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

Prototype

@android.view.RemotableViewMethod
public void setSingleLine(boolean singleLine) 

Source Link

Document

If true, sets the properties of this field (number of lines, horizontally scrolling, transformation method) to be for a single-line input; if false, restores these to the default conditions.

Usage

From source file:Main.java

protected static void makeMultiline(View view) {
    if (view instanceof ViewGroup) {

        ViewGroup grp = (ViewGroup) view;

        for (int index = 0; index < grp.getChildCount(); index++) {
            makeMultiline(grp.getChildAt(index));
        }/*w ww .jav  a 2  s  .  c om*/
    } else if (view instanceof TextView) {
        TextView t = (TextView) view;
        t.setSingleLine(false);
        t.setEllipsize(null);
    }
}

From source file:Main.java

/**
 * Show toast message./*from  w w  w . jav a2s  . c  o  m*/
 *
 * @param context Context
 * @param message Text to display
 */
public static void ShowMessage(Context context, String message) {
    if (context != null) {
        if (TOAST != null) {
            TOAST.cancel();
        }
        Toast newToast = Toast.makeText(context, message,
                message.length() < 15 ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG);
        TextView textView = (TextView) newToast.getView().findViewById(android.R.id.message);
        textView.setGravity(Gravity.CENTER);
        textView.setSingleLine(false);
        newToast.show();
        TOAST = newToast;
    }
}

From source file:Main.java

public static void setText(Activity r, final TextView v, final String text) {
    r.runOnUiThread(new Runnable() {
        @Override/*from www  .j  a  v a  2  s  . c o m*/
        public void run() {
            try {
                v.setSingleLine(false);
                v.setText(Html.fromHtml(text));
            } catch (Exception e) {
            }
        }
    });
}

From source file:com.landenlabs.allperfimages.ui.Ui.java

public static AlertDialog ShowMessage(Activity activity, String message) {
    AlertDialog dialog = new AlertDialog.Builder(activity).setMessage(message).setPositiveButton("More", null)
            .setNegativeButton("Close", null).show();
    dialog.setCanceledOnTouchOutside(true);
    TextView textView = (TextView) dialog.findViewById(android.R.id.message);
    textView.setSingleLine(false);
    textView.setTextSize(20);//from   ww w.ja va  2  s  .c om
    return dialog;
}

From source file:com.hellofyc.base.util.ViewUtils.java

/**
 * ??/*from  w w w  .  java  2  s .com*/
 */
public static void setMarqueeEnabled(TextView textView) {
    textView.setSelected(true);
    textView.setSingleLine(true);
    textView.setMarqueeRepeatLimit(-1);
    textView.setEllipsize(TruncateAt.MARQUEE);
}

From source file:com.nagopy.android.xposed.utilities.ModBrightness.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@XMinSdkVersion(Build.VERSION_CODES.JELLY_BEAN_MR1)
@HandleInitPackageResources(targetPackage = XConst.PKG_SYSTEM_UI, summary = "??")
public static void brightnessDebugger(final String modulePath, final InitPackageResourcesParam resparam,
        final ModBrightnessSettingsGen settings) throws Throwable {
    if (!settings.brightnessDebugger) {
        return;/*from w ww  . ja va  2  s  .  c o  m*/
    }

    resparam.res.hookLayout(XConst.PKG_SYSTEM_UI, "layout", "super_status_bar", new XC_LayoutInflated() {
        @Override
        public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
            LinearLayout parent = (LinearLayout) liparam.view
                    .findViewById(liparam.res.getIdentifier("system_icon_area", "id", XConst.PKG_SYSTEM_UI));

            // ?
            TextView luxTextView = new TextView(parent.getContext());
            luxTextView.setTextSize(8);
            luxTextView.setSingleLine(false);
            luxTextView.setTextColor(Color.WHITE);
            luxTextView.setText("");
            parent.setGravity(Gravity.CENTER_VERTICAL);
            parent.addView(luxTextView, 0);
            AutoBrightnessController autoBrightnessChangedReceiver = new AutoBrightnessController(luxTextView);
            IntentFilter intentFilter = new IntentFilter(
                    AutoBrightnessController.ACTION_AUTO_BRIGHTNESS_CHANGED);
            intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
            parent.getContext().registerReceiver(autoBrightnessChangedReceiver, intentFilter);
        }
    });
}

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

public static void animate_textview_marquee(TextView textView) {
    textView.setTextIsSelectable(true);/*from   ww  w.  j  a  v  a  2  s  .  c  om*/
    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);//  ww w.j a  v a2 s .co  m
    textView.setSingleLine(true);
    textView.setHorizontallyScrolling(true);
    textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);

}

From source file:nf.frex.android.FrexActivity.java

public static void showYesNoDialog(Context context, int titleId, String message,
        DialogInterface.OnClickListener yesListener, DialogInterface.OnClickListener noListener,
        DialogInterface.OnCancelListener cancelListener) {

    TextView textView = new TextView(context);
    textView.setSingleLine(false);
    textView.setPadding(10, 10, 10, 10);
    textView.setText(message);//from   w  w  w .j a  va  2  s. c  om

    AlertDialog.Builder b = new AlertDialog.Builder(context);
    b.setTitle(titleId);
    b.setView(textView);
    b.setCancelable(true);
    if (yesListener != null) {
        b.setPositiveButton(android.R.string.yes, yesListener);
    }
    if (noListener != null) {
        b.setNegativeButton(android.R.string.no, noListener);
    }
    if (cancelListener != null) {
        b.setOnCancelListener(cancelListener);
    }
    b.show();
}

From source file:com.android.settings.widget.RadioButtonPreference.java

@Override
public void onBindViewHolder(PreferenceViewHolder view) {
    super.onBindViewHolder(view);

    TextView title = (TextView) view.findViewById(android.R.id.title);
    if (title != null) {
        title.setSingleLine(false);
        title.setMaxLines(3);//from  w ww  .  j  ava 2  s . com
    }
}