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


Java TextView.setSingleLine方法代码示例

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


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

示例1: onBindView

import android.widget.TextView; //导入方法依赖的package包/类
@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();
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:LearnMorePreference.java

示例2: FrameLayout

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

示例3: createListItem

import android.widget.TextView; //导入方法依赖的package包/类
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;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:NavigationPopup.java

示例4: PhotoEditToolCell

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

示例5: 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.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));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:32,代码来源:PhotoPickerSearchCell.java

示例6: addTextTab

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

示例7: initView

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

示例8: FriendListItem

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

示例9: onBindView

import android.widget.TextView; //导入方法依赖的package包/类
@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);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:ChromeSwitchPreference.java

示例10: FriendListItem

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

示例11: addTextTab

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

示例12: init

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

示例13: addTextTab

import android.widget.TextView; //导入方法依赖的package包/类
public void addTextTab(int position, String title) {
    TextView textTab = new TextView(getContext());
    textTab.setText(title);
    textTab.setGravity(Gravity.CENTER);
    textTab.setSingleLine();
    addTab(position, textTab);
}
 
开发者ID:JackWHLiu,项目名称:jackknife,代码行数:8,代码来源:HorizontalTabBar.java

示例14: generateTitleView

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

示例15: BottomSheetCell

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


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