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


Java TextView.setMaxLines方法代码示例

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


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

示例1: 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

示例2: 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

示例3: initView

import android.widget.TextView; //导入方法依赖的package包/类
private void initView(Context context) {
    mTextView = new TextView(context);
    mClickToShow = new TextView(context);

    mTextView.setTextSize(textSize);
    mTextView.setTextColor(textColor);
    mTextView.setMaxLines(showLine);

    mClickToShow.setBackground(getResources().getDrawable(R.drawable.selector_tx_show_more));
    mClickToShow.setTextSize(textSize);
    mClickToShow.setTextColor(getResources().getColor(R.color.nick));
    mClickToShow.setText(clickText);

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

    params.topMargin = UIHelper.dipToPx(10f);
    mClickToShow.setLayoutParams(params);
    mClickToShow.setOnClickListener(this);

    setOrientation(VERTICAL);
    addView(mTextView);
    addView(mClickToShow);
}
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:24,代码来源:ClickShowMoreLayout.java

示例4: 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

示例5: addView

import android.widget.TextView; //导入方法依赖的package包/类
public void addView(TextView childView, String text) {
    if (push_state_ll.getChildCount() > 3) {
        push_state_ll.removeViewAt(0);
    }
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(0, 0, 0, 10);
    childView.setTextColor(Color.RED);
    childView.setText(text);
    childView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13f);
    childView.setBackgroundResource(R.drawable.text_state);
    childView.setLayoutParams(layoutParams);
    childView.setPadding(15, 10, 15, 10);
    childView.setMaxEms(20);
    childView.setMaxLines(3);
    push_state_ll.addView(childView);
}
 
开发者ID:JunGeges,项目名称:AliZhiBoHao,代码行数:17,代码来源:LiveCameraActivity.java

示例6: showSnackBar

import android.widget.TextView; //导入方法依赖的package包/类
private void showSnackBar(String text) {
    Snackbar snackbar = Snackbar.make(buttonContainer,
            text,
            Snackbar.LENGTH_INDEFINITE);
    View snackbarView = snackbar.getView();
    snackbarView.setBackgroundColor(ContextCompat.getColor(this, R.color.snackbar_color));
    snackbar.setActionTextColor(ContextCompat.getColor(this, R.color.white));
    TextView textView = snackbarView.findViewById(android.support.design.R.id.snackbar_text);
    textView.setMaxLines(10);
    snackbar.setAction(getString(R.string.dismiss), view1 -> snackbar.dismiss());
    snackbar.show();
}
 
开发者ID:BANKEX,项目名称:smart-asset-iot-android-demo,代码行数:13,代码来源:MainActivity.java

示例7: onViewCreated

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mSnackbar = Snackbar.make(view, R.string.changes_saved, Snackbar.LENGTH_INDEFINITE);
    TextView tv = (TextView) mSnackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
    tv.setMaxLines(3);
    mSnackbar.setAction("Close", new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mSnackbar.dismiss();
        }
    });
}
 
开发者ID:Cleveroad,项目名称:AdaptiveTableLayout,代码行数:14,代码来源:TableLayoutFragment.java

示例8: FullTextRowViewHolder

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

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

示例9: fixTextView

import android.widget.TextView; //导入方法依赖的package包/类
private void fixTextView(ViewGroup viewGroup) {
	int count = viewGroup.getChildCount();
	for (int i = 0; i < count; i++) {
		View v = viewGroup.getChildAt(i);
		if (v instanceof TextView) {
			TextView tv = (TextView) v;
			if (isSingleLine(tv)) {
				tv.setSingleLine(false);
				tv.setMaxLines(1);
			}
		} else if (v instanceof ViewGroup) {
			fixTextView((ViewGroup) v);
		}
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:16,代码来源:RemoteViewsUtils.java

示例10: AlbumView

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

    imageView = new BackupImageView(context);
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
    linearLayout.setBackgroundColor(0x7f000000);
    addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 28, Gravity.LEFT | Gravity.BOTTOM));

    nameTextView = new TextView(context);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    nameTextView.setTextColor(0xffffffff);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    nameTextView.setMaxLines(1);
    nameTextView.setGravity(Gravity.CENTER_VERTICAL);
    linearLayout.addView(nameTextView, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f, 8, 0, 0, 0));

    countTextView = new TextView(context);
    countTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    countTextView.setTextColor(0xffaaaaaa);
    countTextView.setSingleLine(true);
    countTextView.setEllipsize(TextUtils.TruncateAt.END);
    countTextView.setMaxLines(1);
    countTextView.setGravity(Gravity.CENTER_VERTICAL);
    linearLayout.addView(countTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, 4, 0, 4, 0));

    selector = new View(context);
    selector.setBackgroundResource(R.drawable.list_selector);
    addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:34,代码来源:PhotoPickerAlbumsCell.java

示例11: AlbumView

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

    imageView = new BackupImageView(context);
    addView(imageView,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
    linearLayout.setBackgroundColor(0x7f000000);
    addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 28,
            Gravity.LEFT | Gravity.BOTTOM));

    nameTextView = new TextView(context);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    nameTextView.setTextColor(0xffffffff);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    nameTextView.setMaxLines(1);
    nameTextView.setGravity(Gravity.CENTER_VERTICAL);
    linearLayout.addView(nameTextView,
            LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f, 8, 0, 0, 0));

    countTextView = new TextView(context);
    countTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    countTextView.setTextColor(0xffaaaaaa);
    countTextView.setSingleLine(true);
    countTextView.setEllipsize(TextUtils.TruncateAt.END);
    countTextView.setMaxLines(1);
    countTextView.setGravity(Gravity.CENTER_VERTICAL);
    linearLayout.addView(countTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, 4, 0, 4, 0));

    selector = new View(context);
    selector.setBackgroundResource(R.drawable.list_selector);
    addView(selector,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:39,代码来源:PhotoPickerAlbumsCell.java

示例12: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    TextView textView = new TextView(this);
    textView.setText("Google Developer Challenge Scholarship - Android Basics");
    textView.setTextSize(56);
    textView.setTextColor(Color.GREEN);
    textView.setMaxLines(2);

    setContentView(textView);
}
 
开发者ID:ItalianCoder,项目名称:Google-Developer-Challenge-Scholarship-Android-Basics,代码行数:13,代码来源:MainActivity.java

示例13: onBindView

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onBindView(View view)
{       
	super.onBindView(view);

	TextView summary= (TextView)view.findViewById(android.R.id.summary);
	summary.setMaxLines(1); //only one line for pref
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:9,代码来源:TorrentBlocklistDialogPreference.java

示例14: TextDetailCell

import android.widget.TextView; //导入方法依赖的package包/类
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));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:28,代码来源:TextDetailCell.java

示例15: BotSwitchCell

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

    textView = new TextView(context);
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    textView.setTextColor(0xff4391cc);
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setMaxLines(1);
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), 14, 0, 14, 0));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:16,代码来源:BotSwitchCell.java


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