TextView setEllipsize - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextView setEllipsize method.

This code example shows how to use the following methods:setVisibility, setEllipsize, setSingleLine, setText, setTextAppearance
This code example shows how to use the following methods:setVisibility, setEllipsize, setGravity, setSingleLine, setText
     * Returns the text view for the app name, creating it if necessary. 
     */ 
    public void setNameText(CharSequence text) {
        if (!TextUtils.isEmpty(text)) {
            if (mNameTextView == null) {
                mNameTextView = new TextView(mContext);
                mNameTextView.setSingleLine(true);
                mNameTextView.setEllipsize(TruncateAt.END);
                mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Large);
                mNameTextView.setGravity(Gravity.CENTER_VERTICAL);
                addView(mNameTextView);
            } 
            mNameTextView.setText(text);
            mNameTextView.setVisibility(View.VISIBLE);
        } else { 
            if (mNameTextView != null) {
                mNameTextView.setVisibility(View.GONE);
            } 
        } 
    } 
8
CodeRank
This code example shows how to use the following methods:getTypeface, setEllipsize, setSingleLine, setTextAppearance, setTypeface
    /** 
     * Returns the text view for the data label, creating it if necessary. 
     */ 
    public TextView getLabelView() {
        if (mLabelView == null) {
            mLabelView = new TextView(mContext);
            mLabelView.setSingleLine(true);
            mLabelView.setEllipsize(TruncateAt.MARQUEE);
            mLabelView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
            mLabelView.setTypeface(mLabelView.getTypeface(), Typeface.BOLD);
            addView(mLabelView);
        } 
        return mLabelView;
    } 
 
    /** 
     * Adds or updates a text view for the data element. 
     */ 
    public void setData(char[] text, int size) {
        if (text == null || size == 0) {
7
CodeRank
This code example shows how to use the following methods:setLayoutParams, setEllipsize, setGravity, setPadding, setSingleLine
            crumbView = view;
            data = tag;
        } 
 
        private TextView makeCrumbView(String name) {
            TextView tv = new TextView(mContext);
            tv.setTextAppearance(mContext, android.R.style.TextAppearance_Medium);
            tv.setPadding(mCrumbPadding, 0, mCrumbPadding, 0);
            tv.setGravity(Gravity.CENTER_VERTICAL);
            tv.setText(name);
            tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                    LayoutParams.MATCH_PARENT));
            tv.setSingleLine();
            tv.setEllipsize(TextUtils.TruncateAt.END);
            return tv;
        } 
 
    } 
 
} 
7
CodeRank
This code example shows how to use the following methods:setId, setLayoutParams, setEllipsize, setLineSpacing, setLines
6
CodeRank
This code example shows how to use the following methods:setId, setLayoutParams, setEllipsize, setPadding, setShadowLayer
     
    wrapperLayoutFeedback.addView(editText);
  } 
 
  private void loadLastUpdatedLabel(Context context) {
    TextView textView = new TextView(context);
    textView.setId(LAST_UPDATED_TEXT_VIEW_ID);
   
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 10.0, getResources().getDisplayMetrics());
    params.setMargins(0, 0, 0, 0);
     
    textView.setLayoutParams(params);
    textView.setPadding(0, margin, 0, margin);
    textView.setEllipsize(TruncateAt.END);
    textView.setShadowLayer(1, 0, 1, Color.WHITE);
    textView.setSingleLine(true);
    textView.setText("Last Updated: ");
    textView.setTextColor(Color.GRAY);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);

5
CodeRank

Related TextView setEllipsize Questions & Answers:

setEllipsize Method Overview
Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle.
See Code Examples for other Android TextView Methods: