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

The following are Jave code examples for showing how to use setSingleLine() 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: chromium-for-android-56-debug-video   File: LearnMorePreference.java   View Source Code Vote up 6 votes
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    TextView titleView = (TextView) view.findViewById(android.R.id.title);
    titleView.setSingleLine(false);

    setSelectable(false);

    titleView.setClickable(true);
    titleView.setTextColor(titleView.getPaint().linkColor);
    titleView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            LearnMorePreference.this.onClick();
        }
    });
}
 
Example 2
Project: EsperantoRadio   File: PagerSlidingTabStrip.java   View Source Code Vote up 6 votes
private void addIconTabBådeTekstOgBillede(final int position, int resId, String url, String title) {
  FrameLayout tabfl = new FrameLayout(getContext());
  ImageView tabi = new ImageView(getContext());
  tabi.setContentDescription(title);
  //Log.d(title+" "+resId + " Kanallogo URL="+url);
  if (resId==0) {
    Picasso.with(tabi.getContext())
            .load(url).placeholder(null)
            .into(tabi);

    tabi.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    tabi.setAdjustViewBounds(true);
    tabi.setVisibility(View.GONE);
  } else {
    tabi.setImageResource(resId);
    tabi.setVisibility(View.INVISIBLE);
  }
  TextView tabt = new TextView(getContext());
  tabt.setText(title);
  tabt.setTypeface(App.skrift_gibson);
  tabt.setGravity(Gravity.CENTER);
  tabt.setSingleLine();

  tabfl.addView(tabi);
  tabfl.addView(tabt);

  LayoutParams lp = (LayoutParams) tabi.getLayoutParams();
  lp.gravity=Gravity.CENTER;
  lp.width=lp.height=ViewGroup.LayoutParams.MATCH_PARENT;
  lp = (LayoutParams) tabt.getLayoutParams();
  lp.width=lp.height=ViewGroup.LayoutParams.MATCH_PARENT;
  lp.gravity=Gravity.CENTER;

  addTab(position, tabfl);
}
 
Example 3
Project: chromium-for-android-56-debug-video   File: NavigationPopup.java   View Source Code Vote up 6 votes
public TextView createListItem() {
    TextView view = new TextView(mContext);
    view.setFadingEdgeLength(mFadeEdgeLength);
    view.setHorizontalFadingEdgeEnabled(true);
    view.setSingleLine();
    view.setTextSize(TEXT_SIZE_SP);
    view.setMinimumHeight(mListItemHeight);
    view.setGravity(Gravity.CENTER_VERTICAL);
    view.setCompoundDrawablePadding(mPadding);
    if (!mIsLayoutDirectionRTL) {
        view.setPadding(mPadding, 0, mPadding + mFadePadding , 0);
    } else {
        view.setPadding(mPadding + mFadePadding, 0, mPadding, 0);
    }
    return view;
}
 
Example 4
Project: PlusGram   File: PhotoEditToolCell.java   View Source Code Vote up 6 votes
public PhotoEditToolCell(Context context) {
    super(context);

    iconImage = new ImageView(context);
    iconImage.setScaleType(ImageView.ScaleType.CENTER);
    addView(iconImage, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 12));

    nameTextView = new TextView(context);
    nameTextView.setGravity(Gravity.CENTER);
    nameTextView.setTextColor(0xffffffff);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
    nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    nameTextView.setMaxLines(1);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM, 4, 0, 4, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(0xff6cc3ff);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
    valueTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 57, 3, 0, 0));
}
 
Example 5
Project: PlusGram   File: PhotoPickerSearchCell.java   View Source Code Vote up 6 votes
public SearchButton(Context context) {
    super(context);

    setBackgroundColor(0xff1a1a1a);

    selector = new View(context);
    selector.setBackgroundResource(R.drawable.list_selector);
    addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.TOP));

    textView1 = new TextView(context);
    textView1.setGravity(Gravity.CENTER_VERTICAL);
    textView1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView1.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView1.setTextColor(0xffffffff);
    textView1.setSingleLine(true);
    textView1.setEllipsize(TextUtils.TruncateAt.END);
    addView(textView1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 51, 8, 4, 0));

    textView2 = new TextView(context);
    textView2.setGravity(Gravity.CENTER_VERTICAL);
    textView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
    textView2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView2.setTextColor(0xff666666);
    textView2.setSingleLine(true);
    textView2.setEllipsize(TextUtils.TruncateAt.END);
    addView(textView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 51, 26, 4, 0));
}
 
Example 6
Project: ThunderMusic   File: PagerTabStrip.java   View Source Code Vote up 5 votes
private void addTextTab(final int position, String title) {

        TextView tab = new TextView(getContext());
        tab.setText(title);
        tab.setGravity(Gravity.CENTER);
        tab.setSingleLine();

        addTab(position, tab);
    }
 
Example 7
Project: JPSpringMenu   File: TitleBar.java   View Source Code Vote up 5 votes
private void initView(Context context) {
    mLeftText = new TextView(context);
    mCenterLayout = new LinearLayout(context);
    mRightLayout = new LinearLayout(context);
    mDividerView = new View(context);

    LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);

    mLeftText.setTextSize(DEFAULT_ACTION_TEXT_SIZE);
    mLeftText.setSingleLine();
    mLeftText.setGravity(Gravity.CENTER_VERTICAL);
    mLeftText.setPadding(mOutPadding + mActionPadding, 0, mOutPadding, 0);

    mCenterText = new TextView(context);
    mSubTitleText = new TextView(context);
    mCenterLayout.addView(mCenterText);
    mCenterLayout.addView(mSubTitleText);

    mCenterLayout.setGravity(Gravity.CENTER);
    mCenterText.setTextSize(DEFAULT_MAIN_TEXT_SIZE);
    mCenterText.setSingleLine();
    mCenterText.setGravity(Gravity.CENTER);
    mCenterText.setEllipsize(TextUtils.TruncateAt.END);

    mSubTitleText.setTextSize(DEFAULT_SUB_TEXT_SIZE);
    mSubTitleText.setSingleLine();
    mSubTitleText.setGravity(Gravity.CENTER);
    mSubTitleText.setEllipsize(TextUtils.TruncateAt.END);

    mRightLayout.setPadding(mOutPadding, 0, mOutPadding, 0);

    addView(mLeftText, layoutParams);
    addView(mCenterLayout);
    addView(mRightLayout, layoutParams);
    addView(mDividerView, new LayoutParams(LayoutParams.MATCH_PARENT, 1));
}
 
Example 8
Project: LQRWeChat-master   File: FriendListItem.java   View Source Code Vote up 5 votes
public FriendListItem(Context context, float ratio) {
	super(context);
	int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING);
	setPadding(itemPadding, 0, itemPadding, 0);
	setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT));
	setBackgroundColor(0xffffffff);

	ivCheck = new ImageView(context);
	LayoutParams lp = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	addView(ivCheck, lp);

	aivIcon = new AsyncImageView(context);
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.setMargins(avatarMargin, 0, avatarMargin, 0);
	addView(aivIcon, lp);

	tvName = new TextView(context);
	tvName.setTextColor(0xff000000);
	tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvName.setSingleLine();
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	lp.weight = 1;
	addView(tvName, lp);

	int resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_check_checked");
	if (resId > 0) {
		bmChd = BitmapFactory.decodeResource(context.getResources(), resId);
	}
	resId = ResHelper.getBitmapRes(getContext(), "ssdk_oks_classic_check_default");
	if (resId > 0) {
		bmUnch = BitmapFactory.decodeResource(context.getResources(), resId);
	}
}
 
Example 9
Project: chromium-for-android-56-debug-video   File: ChromeSwitchPreference.java   View Source Code Vote up 5 votes
@Override
protected void onBindView(View view) {
    super.onBindView(view);

    if (mDrawDivider) {
        int left = view.getPaddingLeft();
        int right = view.getPaddingRight();
        int top = view.getPaddingTop();
        int bottom = view.getPaddingBottom();
        view.setBackground(DividerDrawable.create(getContext()));
        view.setPadding(left, top, right, bottom);
    }

    SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.switch_widget);
    // On BLU Life Play devices SwitchPreference.setWidgetLayoutResource() does nothing. As a
    // result, the user will see a non-material Switch and switchView will be null, hence the
    // null check below. http://crbug.com/451447
    if (switchView != null) {
        switchView.setChecked(isChecked());
    }

    TextView title = (TextView) view.findViewById(android.R.id.title);
    title.setSingleLine(false);
    if (!mDontUseSummaryAsTitle && TextUtils.isEmpty(getTitle())) {
        TextView summary = (TextView) view.findViewById(android.R.id.summary);
        title.setText(summary.getText());
        title.setVisibility(View.VISIBLE);
        summary.setVisibility(View.GONE);
    }

    if (mManagedPrefDelegate != null) mManagedPrefDelegate.onBindViewToPreference(this, view);
}
 
Example 10
Project: LiuAGeAndroid   File: FriendListItem.java   View Source Code Vote up 5 votes
public FriendListItem(Context context, float ratio) {
	super(context);
	int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING);
	setPadding(itemPadding, 0, itemPadding, 0);
	setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT));
	setBackgroundColor(0xffffffff);

	ivCheck = new ImageView(context);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	addView(ivCheck, lp);

	aivIcon = new AsyncImageView(context);
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LinearLayout.LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.setMargins(avatarMargin, 0, avatarMargin, 0);
	addView(aivIcon, lp);

	tvName = new TextView(context);
	tvName.setTextColor(0xff000000);
	tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvName.setSingleLine();
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	lp.weight = 1;
	addView(tvName, lp);

	int resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_check_checked");
	if (resId > 0) {
		bmChd = BitmapFactory.decodeResource(context.getResources(), resId);
	}
	resId = ResHelper.getBitmapRes(getContext(), "ssdk_oks_classic_check_default");
	if (resId > 0) {
		bmUnch = BitmapFactory.decodeResource(context.getResources(), resId);
	}
}
 
Example 11
Project: GitHub   File: PagerSlidingTabStrip.java   View Source Code Vote up 5 votes
private void addTextTab(final int position, String title) {

		TextView tab = new TextView(getContext());
		tab.setText(title);
		tab.setGravity(Gravity.CENTER);
		tab.setSingleLine();

		addTab(position, tab);
	}
 
Example 12
Project: GitHub   File: WheelListView.java   View Source Code Vote up 5 votes
private void init(Context context) {
    setOrientation(LinearLayout.HORIZONTAL);
    int paddingTopBottom = ConvertUtils.toPx(context, ITEM_PADDING_TOP_BOTTOM);
    int paddingLeftRight = ConvertUtils.toPx(context, ITEM_PADDING_LEFT_RIGHT);
    setPadding(paddingLeftRight, paddingTopBottom, paddingLeftRight, paddingTopBottom);
    setGravity(Gravity.CENTER);
    int height = ConvertUtils.toPx(context, ITEM_HEIGHT);
    // fixed: 17-1-8 #79 安卓4.x兼容问题,java.lang.ClassCastException……onMeasure……
    setLayoutParams(new AbsListView.LayoutParams(MATCH_PARENT, height));

    imageView = new ImageView(getContext());
    imageView.setTag(ITEM_TAG_IMAGE);
    imageView.setVisibility(View.GONE);
    LayoutParams imageParams = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    imageParams.rightMargin = ConvertUtils.toPx(context, ITEM_MARGIN);
    addView(imageView, imageParams);

    textView = new TextView(getContext());
    textView.setTag(ITEM_TAG_TEXT);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setSingleLine(true);
    textView.setIncludeFontPadding(false);
    textView.setGravity(Gravity.CENTER);
    textView.setTextColor(Color.BLACK);
    LayoutParams textParams = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    addView(textView, textParams);
}
 
Example 13
Project: jackknife   File: HorizontalTabBar.java   View Source Code Vote up 5 votes
public void addTextTab(int position, String title) {
    TextView textTab = new TextView(getContext());
    textTab.setText(title);
    textTab.setGravity(Gravity.CENTER);
    textTab.setSingleLine();
    addTab(position, textTab);
}
 
Example 14
Project: RunMap   File: PagerIndicator.java   View Source Code Vote up 5 votes
private TextView generateTitleView(String title) {
    TextView tv = new TextView(getContext());
    tv.setGravity(Gravity.CENTER);
    LayoutParams lp = new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
    tv.setText(title);
    tv.setLayoutParams(lp);
    tv.setOnClickListener(this);
    tv.setSingleLine();
    return tv;
}
 
Example 15
Project: airgram   File: BottomSheet.java   View Source Code Vote up 5 votes
public BottomSheetCell(Context context, int type) {
    super(context);

    setBackgroundResource(R.drawable.list_selector);
    setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    textView = new TextView(context);
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    if (type == 0) {
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
    } else if (type == 1) {
        textView.setGravity(Gravity.CENTER);
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
        textView.setTypeface(FontManager.instance().getTypeface());
        addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    }
}
 
Example 16
Project: NanoIconPackLite   File: LiteIconActivityV2.java   View Source Code Vote up 5 votes
private View initCateView() {
    TextView tvCate = new TextView(LiteIconActivityV2.this);
    tvCate.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    tvCate.setTypeface(Typeface.DEFAULT_BOLD);
    tvCate.setTextColor(Color.WHITE);
    tvCate.setSingleLine(true);
    int paddingH = (int) (displayMetrics.density * 16);
    tvCate.setPadding(paddingH, (int) (displayMetrics.density * 16),
            paddingH, (int) (displayMetrics.density * 8));

    return tvCate;
}
 
Example 17
Project: PlusGram   File: TextDetailCell.java   View Source Code Vote up 5 votes
public TextDetailCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(0xff212121);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setSingleLine(true);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 10, LocaleController.isRTL ? 71 : 16, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(0xff8a8a8a);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 35, LocaleController.isRTL ? 71 : 16, 0));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
}
 
Example 18
Project: airgram   File: TextDetailCell.java   View Source Code Vote up 5 votes
public TextDetailCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setTextColor(0xff212121);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 10, LocaleController.isRTL ? 71 : 16, 0));

    valueTextView = new TextView(context);
    valueTextView.setTypeface(FontManager.instance().getTypeface());
    valueTextView.setTextColor(0xff8a8a8a);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 35, LocaleController.isRTL ? 71 : 16, 0));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
}
 
Example 19
Project: XinFramework   File: TitleBar.java   View Source Code Vote up 5 votes
private void initView(Context context) {
        mLeftText = new TextView(context);
        mCenterLayout = new LinearLayout(context);
        mRightLayout = new LinearLayout(context);
        mDividerView = new View(context);

        LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);

        mLeftText.setTextSize(DEFAULT_ACTION_TEXT_SIZE);
        mLeftText.setSingleLine();
        mLeftText.setGravity(Gravity.CENTER_VERTICAL);
        mLeftText.setPadding(mOutPadding + mActionPadding, 0, mOutPadding, 0);

        mCenterText = new TextView(context);
        mSubTitleText = new TextView(context);
        mCenterLayout.addView(mCenterText);
        mCenterLayout.addView(mSubTitleText);

        mCenterLayout.setGravity(Gravity.CENTER);
        mCenterText.setTextSize(DEFAULT_MAIN_TEXT_SIZE);
        mCenterText.setSingleLine();
        mCenterText.setGravity(Gravity.CENTER);
        mCenterText.setEllipsize(TextUtils.TruncateAt.END);

        mSubTitleText.setTextSize(DEFAULT_SUB_TEXT_SIZE);
        mSubTitleText.setSingleLine();
        mSubTitleText.setGravity(Gravity.CENTER);
        mSubTitleText.setEllipsize(TextUtils.TruncateAt.END);

        mRightLayout.setPadding(mOutPadding, 0, mOutPadding, 0);

        addView(mLeftText, layoutParams);
        addView(mCenterLayout);
        addView(mRightLayout, layoutParams);
        addView(mDividerView, new LayoutParams(LayoutParams.MATCH_PARENT, 1));
//        addViewToFadeList(mCenterText);
//        addViewToFadeList(mSubTitleText);
    }
 
Example 20
Project: letv   File: PagerTitleStrip.java   View Source Code Vote up 4 votes
public void setSingleLineAllCaps(TextView text) {
    text.setSingleLine();
}