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


Java TextView.setTextSize方法代码示例

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


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

示例1: setUpReturnOrderView

import android.widget.TextView; //导入方法依赖的package包/类
private void setUpReturnOrderView(ReturnOrderDetailResponse returnOrderDetailResponse) {
        TextView tv = new TextView(getActivityContext());
        tv.setTextSize(14);
        tv.setTextColor(Color.parseColor(getString(R.string.textColorThird)));
        tv.setGravity(Gravity.CENTER_VERTICAL);
        tv.setTag(returnOrderDetailResponse.getReturnOrder().getReturnOrderID());
        if (!TextUtils.isEmpty(returnOrderDetailResponse.getReturnOrder().getName())) {
            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                    CommonUtils.dip2px(getActivityContext(), 40));
            SpannableString ss = new SpannableString(getString(R.string.tag_return_order_num) + returnOrderDetailResponse.getReturnOrder().getName());
            ss.setSpan(new ForegroundColorSpan(Color.parseColor(getString(R.string.color_return_order_num))), 5, 5 + returnOrderDetailResponse.getReturnOrder().getName().length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
            tv.setText(ss);
            mLlReturn.addView(tv, params);
            tv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //跳转到退货单详情
//                    Intent intent = new Intent(mContext, ReturnDetailActivity.class);
//                    intent.putExtra("rid", returnId);
//                    startActivity(intent);
                }
            });
        }
    }
 
开发者ID:ebridfighter,项目名称:GongXianSheng,代码行数:25,代码来源:OrderDetailActivity.java

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

示例3: createItem

import android.widget.TextView; //导入方法依赖的package包/类
protected View createItem(final ItemInfo info) {
    TextView textView = new TextView(mActivity);
    textView.setText(info.mItemText);
    textView.setTextColor(SkinHelper.getSkin().getThemeSubColor());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, SkinHelper.getSkin().getMainTextSize());
    textView.setGravity(Gravity.CENTER);
    if (info.mClickListener instanceof RClickListener) {
        textView.setOnClickListener(info.mClickListener);
    } else {
        textView.setOnClickListener(new RClickListener(1000) {
            @Override
            public void onRClick(View view) {
                info.mClickListener.onClick(view);
                if (info.autoCloseDialog) {
                    finishDialog();
                }
            }
        });
    }
    return textView;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:22,代码来源:UIItemDialog.java

示例4: updateTabStyles

import android.widget.TextView; //导入方法依赖的package包/类
private void updateTabStyles() {
        for (int i = 0; i < mTabCount; i++) {
            View tabView = mTabsContainer.getChildAt(i);
            tabView.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
            TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title);
            tv_tab_title.setTextColor(i == mCurrentTab ? mTextSelectColor : mTextUnselectColor);
            tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextsize);
//            tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
            if (mTextAllCaps) {
                tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase());
            }

            if (mTextBold == TEXT_BOLD_BOTH) {
                tv_tab_title.getPaint().setFakeBoldText(true);
            } else if (mTextBold == TEXT_BOLD_NONE) {
                tv_tab_title.getPaint().setFakeBoldText(false);
            }
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:SegmentTabLayout.java

示例5: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LinearLayout root = new LinearLayout(this);
    root.setPadding(30, 30, 30, 30);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    root.setLayoutParams(lp);

    setContentView(root);

    // textView
    TextView textView = new TextView(this);
    textView.setText("Theme: Dialog");
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(30);
    LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    textView.setLayoutParams(lp2);
    root.addView(textView);
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:20,代码来源:ThemeDialogActivity.java

示例6: createTextView

import android.widget.TextView; //导入方法依赖的package包/类
private TextView createTextView() {
    TextView textView = new TextView(this);
    textView.setLayoutParams(new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    textView.setTextColor(Color.CYAN);
    textView.setTextSize(30f);
    textView.setBackgroundColor(Color.RED);
    textView.setText("tips view");
    return textView;
}
 
开发者ID:arjinmc,项目名称:Android-GuideView,代码行数:11,代码来源:MainActivity.java

示例7: onBindView

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onBindView(Pager.Page page, Holder holder, Element element) {
    super.onBindView(page, holder, element);
    String text = (String) element.getData();
    TextView view = (TextView) holder.getRoot();
    view.setText(text);
    int size, textColor, bgColor;
    switch (element.getElementType()) {
        case TYPE_TEXT_SMALL:
            size = 16;
            textColor = Color.GRAY;
            bgColor = Color.TRANSPARENT;
            break;
        case TYPE_TEXT_MESSAGE:
            size = 18;
            textColor = Color.WHITE;
            bgColor = ContextCompat.getColor(getContext(), R.color.colorAccent);
            // textColor = Color.DKGRAY;
            // bgColor = Color.WHITE;
            break;
        case TYPE_TEXT_LARGE:
        default:
            size = 22;
            textColor = Color.BLACK;
            bgColor = Color.TRANSPARENT;
            break;
    }
    view.setTextSize(size);
    view.setTextColor(textColor);
    view.setBackgroundColor(bgColor);

}
 
开发者ID:natario1,项目名称:Elements,代码行数:33,代码来源:Presenter.java

示例8: onCreateContent

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreateContent(QMUIDialog dialog, ViewGroup parent) {
    TextView contentTv = new TextView(mContext);
    contentTv.setTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_gray_4));
    contentTv.setText(mContent);
    contentTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_block_content_text_size));
    contentTv.setLineSpacing(QMUIDisplayHelper.dpToPx(2), 1.0f);
    contentTv.setPadding(
            QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_padding_horizontal),
            QMUIResHelper.getAttrDimen(mContext, hasTitle() ? R.attr.qmui_dialog_content_padding_top : R.attr.qmui_dialog_content_padding_top_when_no_title),
            QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_padding_horizontal),
            QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_content_padding_bottom_when_action_block)
    );
    parent.addView(contentTv);
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:16,代码来源:QMUIDialogBlockBuilder.java

示例9: addTextView

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * 向父容器中添加TextView
 *
 * @param text  TextView显示文字
 * @param color TextView的背景颜色,如:"#FADBCC"
 */
private void addTextView(Context context, String text, int color) {
    TextView textView = new TextView(context);
    textView.setBackgroundColor(color);
    textView.setText(text);
    textView.setTextColor(textColor);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    textView.setSingleLine();
    textView.setGravity(Gravity.CENTER);
    textView.setLayoutParams(new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1.0F));
    this.addView(textView);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:IndicatorView.java

示例10: initBottom

import android.widget.TextView; //导入方法依赖的package包/类
private void initBottom(LinearLayout llBottom, float ratio) {
	LinearLayout llAt = new LinearLayout(activity);
	llAt.setPadding(0, 0, 0, 5);
	llAt.setBackgroundColor(0xffffffff);
	int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
	llBottom.addView(llAt, lp);

	tvAt = new TextView(activity);
	tvAt.setTextColor(0xff3b3b3b);
	tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
	tvAt.setGravity(Gravity.BOTTOM);
	tvAt.setText("@");
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvAt.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	llAt.addView(tvAt, lp);
	tvAt.setOnClickListener(this);
	if (isShowAtUserLayout(platform.getName())) {
		tvAt.setVisibility(View.VISIBLE);
	} else {
		tvAt.setVisibility(View.INVISIBLE);
	}

	tvTextCouter = new TextView(activity);
	tvTextCouter.setTextColor(0xff3b3b3b);
	tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
	onTextChanged(etContent.getText(), 0, 0, 0);
	tvTextCouter.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.weight = 1;
	llAt.addView(tvTextCouter, lp);

	View v = new View(activity);
	v.setBackgroundColor(0xffcccccc);
	int px1 = ratio > 1 ? ((int) ratio) : 1;
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1);
	llBottom.addView(v, lp);
}
 
开发者ID:lo625090140,项目名称:lqrwechatrongcloud,代码行数:41,代码来源:EditPagePort.java

示例11: PRTHeader

import android.widget.TextView; //导入方法依赖的package包/类
public PRTHeader(Context context) {
	super(context);
	int[] size = R.getScreenSize(context);
	float screenWidth = size[0] < size[1] ? size[0] : size[1];
	float ratio = screenWidth / DESIGN_SCREEN_WIDTH;

	setOrientation(VERTICAL);

	LinearLayout llInner = new LinearLayout(context);
	LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_HORIZONTAL;
	addView(llInner, lp);

	ivArrow = new RotateImageView(context);
	int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr");
	if (resId > 0) {
		ivArrow.setImageResource(resId);
	}
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.topMargin = lp.bottomMargin = avataPadding;
	llInner.addView(ivArrow, lp);

	pbRefreshing = new ProgressBar(context);
	resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar");
	Drawable pbdrawable = context.getResources().getDrawable(resId);
	pbRefreshing.setIndeterminateDrawable(pbdrawable);
	llInner.addView(pbRefreshing, lp);
	pbRefreshing.setVisibility(View.GONE);

	tvHeader = new TextView(getContext());
	tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
	tvHeader.setTextColor(0xff09bb07);
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(tvHeader, lp);
}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:41,代码来源:PRTHeader.java

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

示例13: initVideoView

import android.widget.TextView; //导入方法依赖的package包/类
private void initVideoView(Context context) {
    mAppContext = context.getApplicationContext();
    mSettings = new Settings(mAppContext);

    initBackground();
    initRenders();

    mVideoWidth = 0;
    mVideoHeight = 0;
    // REMOVED: getHolder().addCallback(mSHCallback);
    // REMOVED: getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    setFocusable(true);
    setFocusableInTouchMode(true);
    requestFocus();
    // REMOVED: mPendingSubtitleTracks = new Vector<Pair<InputStream, MediaFormat>>();
    mCurrentState = STATE_IDLE;
    mTargetState = STATE_IDLE;

    subtitleDisplay = new TextView(context);
    subtitleDisplay.setTextSize(24);
    subtitleDisplay.setGravity(Gravity.CENTER);
    LayoutParams layoutParams_txt = new LayoutParams(
            LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT,
            Gravity.BOTTOM);
    addView(subtitleDisplay, layoutParams_txt);
}
 
开发者ID:bigjelly,项目名称:ShaddockVideoPlayer,代码行数:28,代码来源:IjkVideoView.java

示例14: setTextSize

import android.widget.TextView; //导入方法依赖的package包/类
private static void setTextSize(Toast toast) {
    TextView view = getTextView(toast);
    Context context=view.getContext();
    int size = context.getResources().getDimensionPixelSize(R.dimen.text_size_middle2);
    view.setTextSize(TypedValue.COMPLEX_UNIT_PX,ScreenUtil.getScalePxValue(size));
}
 
开发者ID:qsyj,项目名称:ShortcutMenu,代码行数:7,代码来源:ToastUtil.java

示例15: initTitle

import android.widget.TextView; //导入方法依赖的package包/类
private void initTitle(RelativeLayout rlTitle, float ratio) {
	tvCancel = new TextView(activity);
	tvCancel.setTextColor(0xff3b3b3b);
	tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvCancel.setGravity(Gravity.CENTER);
	int resId = R.getStringRes(activity, "ssdk_oks_cancel");
	if (resId > 0) {
		tvCancel.setText(resId);
	}
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvCancel.setPadding(padding, 0, padding, 0);
	RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	rlTitle.addView(tvCancel, lp);
	tvCancel.setOnClickListener(this);

	TextView tvTitle = new TextView(activity);
	tvTitle.setTextColor(0xff3b3b3b);
	tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
	tvTitle.setGravity(Gravity.CENTER);
	resId = R.getStringRes(activity, "ssdk_oks_contacts");
	if (resId > 0) {
		tvTitle.setText(resId);
	}
	lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.addRule(RelativeLayout.CENTER_IN_PARENT);
	rlTitle.addView(tvTitle, lp);

	tvConfirm = new TextView(activity);
	tvConfirm.setTextColor(0xffff6d11);
	tvConfirm.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvConfirm.setGravity(Gravity.CENTER);
	resId = R.getStringRes(activity, "ssdk_oks_confirm");
	if (resId > 0) {
		tvConfirm.setText(resId);
	}
	tvConfirm.setPadding(padding, 0, padding, 0);
	lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	rlTitle.addView(tvConfirm, lp);
	tvConfirm.setOnClickListener(this);
}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:42,代码来源:FriendListPage.java


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