Java Code Examples for android.widget.TextView.getEllipsize()

The following are Jave code examples for showing how to use getEllipsize() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PeSanKita-android   File: ViewUtil.java   View Source Code Vote up 5 votes
public static CharSequence ellipsize(@Nullable CharSequence text, @NonNull TextView view) {
  if (TextUtils.isEmpty(text) || view.getWidth() == 0 || view.getEllipsize() != TruncateAt.END) {
    return text;
  } else {
    return TextUtils.ellipsize(text,
                               view.getPaint(),
                               view.getWidth() - view.getPaddingRight() - view.getPaddingLeft(),
                               TruncateAt.END);
  }
}
 
Example 2
Project: Cable-Android   File: ViewUtil.java   View Source Code Vote up 5 votes
public static CharSequence ellipsize(@Nullable CharSequence text, @NonNull TextView view) {
  if (TextUtils.isEmpty(text) || view.getWidth() == 0 || view.getEllipsize() != TruncateAt.END) {
    return text;
  } else {
    return TextUtils.ellipsize(text,
                               view.getPaint(),
                               view.getWidth() - view.getPaddingRight() - view.getPaddingLeft(),
                               TruncateAt.END);
  }
}