当前位置: 首页>>代码示例>>Java>>正文


Java TextView.setEllipsize方法代码示例

本文整理汇总了Java中android.widget.TextView.setEllipsize方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setEllipsize方法的具体用法?Java TextView.setEllipsize怎么用?Java TextView.setEllipsize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setEllipsize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SearchButton

import android.widget.TextView; //导入方法依赖的package包/类
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.setTypeface(FontManager.instance().getTypeface());
    textView1.setGravity(Gravity.CENTER_VERTICAL);
    textView1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView1.setTypeface(FontManager.instance().getTypeface());
    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.setTypeface(FontManager.instance().getTypeface());
    textView2.setGravity(Gravity.CENTER_VERTICAL);
    textView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
    textView2.setTypeface(FontManager.instance().getTypeface());
    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));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:34,代码来源:PhotoPickerSearchCell.java

示例2: createTextView

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * 创建 TextView 并返回
 *
 * @return {@link TextView}
 */
private TextView createTextView()
{
    TextView tv = new TextView(context);
    tv.setGravity(Gravity.CENTER);
    tv.setTextColor(textColor);
    tv.setTextSize(textSize);
    tv.setMaxLines(1);
    tv.setEllipsize(TextUtils.TruncateAt.END);
    tv.setBackgroundDrawable(createFrameDrawableBg());
    return tv;
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:17,代码来源:NewAuthEditText.java

示例3: ShareDialogCell

import android.widget.TextView; //导入方法依赖的package包/类
public ShareDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    int nColor = themePrefs.getInt("chatAttachTextColor", 0xff757575);
    nameTextView = new TextView(context);
    //nameTextView.setTextColor(0xff212121);
    nameTextView.setTextColor(nColor != 0xff757575 ? nColor : 0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    checkBox = new CheckBox(context, R.drawable.round_check2);
    checkBox.setSize(24);
    checkBox.setCheckOffset(AndroidUtilities.dp(1));
    checkBox.setVisibility(VISIBLE);
    checkBox.setColor(0xff3ec1f9);
    addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 17, 39, 0, 0));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:27,代码来源:ShareDialogCell.java

示例4: getCellView

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getCellView(final int rowIndex, final int columnIndex, final ViewGroup parentView) {
    final TextView textView = new TextView(getContext());
    textView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    textView.setTypeface(textView.getTypeface(), typeface);
    textView.setTextSize(textSize);
    textView.setTextColor(textColor);
    textView.setSingleLine();
    textView.setEllipsize(TextUtils.TruncateAt.END);

    try {
        final String textToShow = getItem(rowIndex)[columnIndex];
        textView.setText(textToShow);
    } catch (final IndexOutOfBoundsException e) {
        Log.w(LOG_TAG, "No Sting given for row " + rowIndex + ", column " + columnIndex + ". "
                + "Caught exception: " + e.toString());
        // Show no text
    }

    return textView;
}
 
开发者ID:datalink747,项目名称:Sortable_tableview_soussidev,代码行数:22,代码来源:SimpleTableDataAdapter.java

示例5: HistoryItemCell

import android.widget.TextView; //导入方法依赖的package包/类
public HistoryItemCell(Context context) {
    super(context);

    codeView = new TextView(context);
    codeView.setTextColor(Color.BLUE);
    codeView.setTextSize(24);
    codeView.setLines(1);
    codeView.setEllipsize(TextUtils.TruncateAt.END);
    addView(codeView);

    urlView = new TextView(context);
    urlView.setTextColor(Color.BLACK);
    urlView.setTextSize(16);
    urlView.setLines(1);
    urlView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
    addView(urlView);

    dateView = new TextView(context);
    dateView.setTextColor(Color.LTGRAY);
    dateView.setTextSize(12);
    dateView.setGravity(Gravity.RIGHT);
    addView(dateView);
}
 
开发者ID:Sea-n,项目名称:gitio,代码行数:24,代码来源:HistoryItemCell.java

示例6: getHeaderView

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getHeaderView(final int columnIndex, final ViewGroup parentView) {
    final TextView textView = new TextView(getContext());

    if (columnIndex < headers.length) {
        textView.setText(headers[columnIndex]);
    }

    textView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    textView.setTypeface(textView.getTypeface(), typeface);
    textView.setTextSize(textSize);
    textView.setTextColor(textColor);
    textView.setSingleLine();
    textView.setEllipsize(TextUtils.TruncateAt.END);

    return textView;
}
 
开发者ID:datalink747,项目名称:Sortable_tableview_soussidev,代码行数:18,代码来源:SimpleTableHeaderAdapter.java

示例7: JoinSheetUserCell

import android.widget.TextView; //导入方法依赖的package包/类
public JoinSheetUserCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(1);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(1);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:18,代码来源:JoinSheetUserCell.java

示例8: AttachBotButton

import android.widget.TextView; //导入方法依赖的package包/类
public AttachBotButton(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTypeface(FontManager.instance().getTypeface());
    nameTextView.setTextColor(Theme.ATTACH_SHEET_TEXT_COLOR);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 65, 6, 0));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:18,代码来源:ChatAttachAlert.java

示例9: LeftHolder

import android.widget.TextView; //导入方法依赖的package包/类
LeftHolder(View view) {
    super(view);

    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    view.setLayoutParams(params);
    item = new TextView(view.getContext());
    item.setLayoutParams(params);
    item.setMaxLines(1);
    item.setEllipsize(TextUtils.TruncateAt.END);
    item.setGravity(Gravity.CENTER_VERTICAL);
    item.setTextColor(ContextCompat.getColor(view.getContext(), R.color.gray_black));
    item.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimension(R.dimen.app_normal_margin));
    item.setCompoundDrawablePadding(leftPadding);
    item.setPadding(padding, padding, padding, padding);

    TypedValue typedValue = new TypedValue();
    view.getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true);
    item.setBackgroundResource(typedValue.resourceId);

    ((LinearLayout) view).addView(item);
}
 
开发者ID:yangchong211,项目名称:YCDialog,代码行数:23,代码来源:DialogAdapter.java

示例10: buildTextView

import android.widget.TextView; //导入方法依赖的package包/类
private TextView buildTextView(Context context, CharSequence text) {
    TextView textView = new TextView(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
    textView.setLayoutParams(params);
    textView.setTextColor(mTextColor);
    textView.setText(text);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSize);
    textView.setMaxLines(3);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(Gravity.CENTER);
    textView.setPadding(mPaddingHorizontal, mPaddingVertical, mPaddingHorizontal, mPaddingVertical);
    return textView;
}
 
开发者ID:TechIsFun,项目名称:SlidingSwitch,代码行数:14,代码来源:SlidingSwitch.java

示例11: configureTextView

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
 * @param view the text view to be configured
 */
protected void configureTextView(TextView view) {
    view.setTextColor(textColor);
    view.setGravity(Gravity.CENTER);
    view.setPadding(0, padding, 0, padding);
    view.setTextSize(textSize);
    view.setEllipsize(TextUtils.TruncateAt.END);
    view.setLines(1);
    //        view.setCompoundDrawablePadding(20);
    //        view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:AbstractWheelTextAdapter.java

示例12: ExpandTextView

import android.widget.TextView; //导入方法依赖的package包/类
public ExpandTextView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    mText = new TextView(context, attrs);
    mText.setTextColor(mTextColor);
    mText.setEllipsize(TextUtils.TruncateAt.END);
    mText.setMaxLines(mTextLine);
    addView(mText, params);
    mExpandText = new TextView(context);
    mExpandText.setTextColor(Color.TRANSPARENT);
    addView(mExpandText, params);
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:14,代码来源:ExpandTextView.java

示例13: CastViewHolder

import android.widget.TextView; //导入方法依赖的package包/类
public CastViewHolder(ViewHolder parentViewHolder, View contentView) {
    super(parentViewHolder.view);

    mFullWidthViewHolder = parentViewHolder;
    mDirectorsTv = (TextView)contentView.findViewById(R.id.directors);
    mCastTv = (TextView)contentView.findViewById(R.id.cast);
    if (mMaxLines>0) {
        mCastTv.setMaxLines(mMaxLines);
        mCastTv.setEllipsize(TextUtils.TruncateAt.END);
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:12,代码来源:CastRowPresenter.java

示例14: getView

import android.widget.TextView; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
	LinearLayout llContent = new LinearLayout(getContext());
	llContent.setOrientation(LinearLayout.VERTICAL);
	final GlideImageView aivIcon = new GlideImageView(getContext());
	int aivIconWidth = ResHelper.dipToPx(getContext(), 40);
	LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(aivIconWidth, aivIconWidth);
	llp.gravity = Gravity.CENTER_HORIZONTAL;
	llContent.addView(aivIcon, llp);

	TextView tvForumName = new TextView(getContext());
	tvForumName.setTextColor(0xff3a4045);
	tvForumName.setTextSize(TypedValue.COMPLEX_UNIT_PX, ResHelper.dipToPx(getContext(), 14));
	tvForumName.setEllipsize(TextUtils.TruncateAt.MIDDLE);
	tvForumName.setSingleLine();
	llp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
	llp.gravity = Gravity.CENTER_HORIZONTAL;
	llp.topMargin = ResHelper.dipToPx(getContext(), 8);
	llContent.addView(tvForumName, llp);

	ForumForum forum = getItem(position);
	if (forum != null) {
		tvForumName.setText(forum.name);
		if (!TextUtils.isEmpty(forum.forumPic)) {
			aivIcon.setExecuteRound(ResHelper.dipToPx(getContext(), 5));
			aivIcon.setScaleType(ImageView.ScaleType.CENTER_CROP);
		}
		aivIcon.execute(forum.forumPic, forum.fid == 0 ? defaultTotalForumPic : defaultForumPic);
	} else {
		aivIcon.setImageResource(defaultForumPic);
	}
	return llContent;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:33,代码来源:ForumForumView.java

示例15: MentionCell

import android.widget.TextView; //导入方法依赖的package包/类
public MentionCell(Context context) {
    super(context);

    setOrientation(HORIZONTAL);

    setBackgroundResource(R.drawable.list_selector);

    avatarDrawable = new AvatarDrawable();
    avatarDrawable.setSmallStyle(true);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(14));
    addView(imageView, LayoutHelper.createLinear(28, 28, 12, 4, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff000000);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    nameTextView.setSingleLine(true);
    nameTextView.setGravity(Gravity.LEFT);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 12, 0, 0, 0));

    usernameTextView = new TextView(context);
    usernameTextView.setTextColor(0xff999999);
    usernameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    usernameTextView.setSingleLine(true);
    usernameTextView.setGravity(Gravity.LEFT);
    usernameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(usernameTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 12, 0, 8, 0));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:31,代码来源:MentionCell.java


注:本文中的android.widget.TextView.setEllipsize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。