Java Code Examples for android.text.TextPaint#setFakeBoldText()
The following examples show how to use
android.text.TextPaint#setFakeBoldText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SaveConfirmDialog.java From fanfouapp-opensource with Apache License 2.0 | 6 votes |
private void init() { setContentView(R.layout.dialog_save_confirm); this.mTitleView = (TextView) findViewById(R.id.title); final TextPaint tp = this.mTitleView.getPaint(); tp.setFakeBoldText(true); this.mTitleView.setText(this.mTitle); this.mTextView = (TextView) findViewById(R.id.text); this.mTextView.setText(this.mText); this.mButtonSave = (Button) findViewById(R.id.button_save); this.mButtonSave.setOnClickListener(this); this.mButtonDisCard = (Button) findViewById(R.id.button_discard); this.mButtonDisCard.setOnClickListener(this); this.mButtonCancel = (Button) findViewById(R.id.button_cancel); this.mButtonCancel.setOnClickListener(this); }
Example 2
Source File: BlogAdapter.java From LoveTalkClient with Apache License 2.0 | 6 votes |
TextView getTextView() { //设置TextView的样式 AbsListView.LayoutParams lp = new AbsListView.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, 64); TextView textView = new TextView( mContext); textView.setLayoutParams(lp); textView.setGravity(Gravity.CENTER_VERTICAL); //设置TextView的Padding值 textView.setPadding(16, -10, 0, 32); //设置TextView的字体大小 textView.setTextSize(14); //设置TextView的字体颜色 textView.setTextColor(Color.WHITE); //设置字体加粗 TextPaint txt = textView.getPaint(); txt.setFakeBoldText(true); return textView; }
Example 3
Source File: PopupMulAdapter.java From FilterTabView with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { ViewHolder viewHolder = (ViewHolder) holder; BaseFilterBean bean = mList.get(position); if (SpUtils.getInstance(mContext).getTextStyle() == 1) { TextPaint textPaint = viewHolder.tv_classify_name.getPaint(); textPaint.setFakeBoldText(true); } viewHolder.tv_classify_name.setText(bean.getSortTitle()); final ItemSelectAdapter adapter = new ItemSelectAdapter(mContext, bean.getChildList(), bean.isCanMulSelect()); GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, SpUtils.getInstance(mContext).getColumnNum()); viewHolder.rv_select.setLayoutManager(gridLayoutManager); viewHolder.rv_select.setAdapter(adapter); }
Example 4
Source File: Card.java From android2048 with Apache License 2.0 | 6 votes |
public Card(Context context) { super(context); LayoutParams lp = null; background = new View(getContext()); lp = new LayoutParams(-1, -1); lp.setMargins(10, 10, 0, 0); background.setBackgroundColor(getResources().getColor( R.color.normalCardBack)); addView(background, lp); label = new TextView(getContext()); label.setTextSize(28); label.setGravity(Gravity.CENTER); TextPaint tp = label.getPaint(); tp.setFakeBoldText(true); lp = new LayoutParams(-1, -1); lp.setMargins(10, 10, 0, 0); addView(label, lp); setNum(0); }
Example 5
Source File: CourseView.java From ClassSchedule with Apache License 2.0 | 6 votes |
@NonNull private TextView getCourseTextView(int h, int w) { TextView tv = new TextView(getContext()); LayoutParams params = new LayoutParams(w, h); tv.setLayoutParams(params); tv.setTextColor(mTextColor); tv.setLineSpacing(-2, 1); tv.setPadding(mTextLRPadding, mTextTBPadding, mTextLRPadding, mTextTBPadding); tv.setTextColor(mTextColor); tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSize); tv.setFocusable(true); tv.setClickable(true); //bold TextPaint tp = tv.getPaint(); tp.setFakeBoldText(true); return tv; }
Example 6
Source File: FunctionUtils.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 6 votes |
public static void handleNickName(MessageArticlePageInfo row, int fgColor, TextView nickNameTV, Context context) { initStaticStrings(context); String nickName = row.getAuthor(); // int now = 0; if ("-1".equals(row.getYz()))// nuked { fgColor = nickNameTV.getResources().getColor(R.color.title_red); nickName += "(VIP)"; } else if (!StringUtils.isEmpty(row.getMute_time()) && !"0".equals(row.getMute_time())) { fgColor = nickNameTV.getResources().getColor(R.color.title_orange); nickName += "(" + legend + ")"; } nickNameTV.setText(nickName); TextPaint tp = nickNameTV.getPaint(); tp.setFakeBoldText(true);// bold for Chinese character nickNameTV.setTextColor(fgColor); }
Example 7
Source File: UDTextView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
/** * 设置字体加粗 * * @return */ public UDTextView setfontBold() { T view = getView(); if (view != null) { TextPaint textPaint = view.getPaint(); if (textPaint != null) { textPaint.setFakeBoldText(true); } } return this; }
Example 8
Source File: SquareKey.java From PasscodeView with Apache License 2.0 | 5 votes |
/** * Public constructor. */ private SquareKey(@NonNull SquareKey.Builder builder, @NonNull final String keyTitle, @NonNull final Rect bound) { super(builder, keyTitle, bound); mBuilder = builder; //Set the keyboard paint mKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mKeyPaint.setStyle(Paint.Style.STROKE); mKeyPaint.setColor(builder.mKeyStrokeColor); mKeyPaint.setTextSize(builder.mKeyTextSize); mKeyPaint.setStrokeWidth(builder.mKeyStrokeWidth); //Set the keyboard text paint mKeyTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mKeyTextPaint.setColor(builder.mKeyTextColor); mKeyTextPaint.setTextSize(builder.mKeyTextSize); mKeyTextPaint.setFakeBoldText(true); mKeyTextPaint.setTextAlign(Paint.Align.CENTER); //Ripple paint mRipplePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mRipplePaint.setStyle(Paint.Style.STROKE); mRipplePaint.setColor(Utils.makeColorDark(builder.mKeyStrokeColor)); mRipplePaint.setStrokeWidth(builder.mKeyStrokeWidth); //Error animator mErrorAnimator = ValueAnimator.ofInt(0, 10); mErrorAnimator.setInterpolator(new CycleInterpolator(2)); mErrorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { getBounds().left += (int) animation.getAnimatedValue(); getBounds().right += (int) animation.getAnimatedValue(); getPasscodeView().invalidate(); } }); }
Example 9
Source File: MessageCursorAdapter.java From fanfouapp-opensource with Apache License 2.0 | 5 votes |
private void setTextStyle(final ViewHolder holder) { final int fontSize = getFontSize(); holder.contentText.setTextSize(fontSize); holder.nameText.setTextSize(fontSize); holder.dateText.setTextSize(fontSize - 4); final TextPaint tp = holder.nameText.getPaint(); tp.setFakeBoldText(true); if (this.autoLink) { holder.contentText.setAutoLinkMask(Linkify.ALL); } }
Example 10
Source File: DisplayUtils.java From nextcloud-notes with GNU General Public License v3.0 | 5 votes |
@Override public void updateDrawState(TextPaint tp) { if (current) { if (NotesApplication.isDarkThemeActive(context)) { if (isColorDark(mainColor)) { tp.bgColor = Color.WHITE; tp.setColor(mainColor); } else { tp.bgColor = mainColor; tp.setColor(Color.BLACK); } } else { if (isColorDark(mainColor)) { tp.bgColor = mainColor; tp.setColor(Color.WHITE); } else { if (ColorUtil.contrastRatioIsSufficient(mainColor, highlightColor)) { tp.bgColor = highlightColor; } else { tp.bgColor = Color.BLACK; } tp.setColor(mainColor); } } } else { tp.bgColor = highlightColor; tp.setColor(BrandingUtil.getSecondaryForegroundColorDependingOnTheme(context, mainColor)); } tp.setFakeBoldText(true); }
Example 11
Source File: GarbageFileListAdapter.java From letv with Apache License 2.0 | 5 votes |
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; boolean z = true; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(this.mContext).inflate(R.layout.garbage_file_item, null); ViewHolder.access$002(holder, (TextView) convertView.findViewById(R.id.tv_garbage_file_item_type)); ViewHolder.access$102(holder, (TextView) convertView.findViewById(R.id.tv_garbage_file_item_size)); ViewHolder.access$202(holder, (ImageView) convertView.findViewById(R.id.iv_garbage_file_selection)); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (!(this.mList == null || this.mList.get(position) == null)) { boolean z2; ViewHolder.access$000(holder).setText(getNameByType(((GarbageFileInfo) this.mList.get(position)).type)); TextPaint tp = ViewHolder.access$000(holder).getPaint(); if (position == 0) { z2 = true; } else { z2 = false; } tp.setFakeBoldText(z2); tp = ViewHolder.access$100(holder).getPaint(); if (position != 0) { z = false; } tp.setFakeBoldText(z); StringBuilder sb = new StringBuilder(); sb.append(GarbageCleanActivity.transformShortType(((GarbageFileInfo) this.mList.get(position)).size)); sb.append(GarbageCleanActivity.transformUnit(((GarbageFileInfo) this.mList.get(position)).size)); ViewHolder.access$100(holder).setText(sb.toString()); } if (this.mGarbageFileTypeSelectionList.contains(((GarbageFileInfo) this.mList.get(position)).type)) { ViewHolder.access$200(holder).setVisibility(0); } else { ViewHolder.access$200(holder).setVisibility(4); } return convertView; }
Example 12
Source File: StatusArrayAdapter.java From fanfouapp-opensource with Apache License 2.0 | 5 votes |
private void setTextStyle(final ViewHolder holder) { final int fontSize = getFontSize(); holder.contentText.setTextSize(fontSize); holder.nameText.setTextSize(fontSize); holder.metaText.setTextSize(fontSize - 4); final TextPaint tp = holder.nameText.getPaint(); tp.setFakeBoldText(true); }
Example 13
Source File: ConversationAdapter.java From fanfouapp-opensource with Apache License 2.0 | 5 votes |
private void setTextStyle(final ViewHolder holder) { final int fontSize = getFontSize(); holder.contentText.setTextSize(fontSize); holder.nameText.setTextSize(fontSize); holder.metaText.setTextSize(fontSize - 4); final TextPaint tp = holder.nameText.getPaint(); tp.setFakeBoldText(true); }
Example 14
Source File: SyntaxHighlightSpan.java From CodeEditor with Apache License 2.0 | 5 votes |
@Override public void updateDrawState(TextPaint tp) { tp.setColor(color); tp.setFakeBoldText(bold); if(italics) { tp.setTextSkewX(-0.1f); } }
Example 15
Source File: LrcView.java From APlayer with GNU General Public License v3.0 | 5 votes |
/** * 初始化画笔等 */ @Override public void init() { mScroller = new Scroller(getContext(), DEFAULT_INTERPOLATOR); mPaintForHighLightLrc = new TextPaint(); mPaintForHighLightLrc.setAntiAlias(true); mPaintForHighLightLrc.setColor(mColorForHighLightLrc); float size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 15, getContext().getResources().getDisplayMetrics()); mSizeForHighLightLrc = size; mPaintForHighLightLrc.setTextSize(mSizeForHighLightLrc); mPaintForHighLightLrc.setFakeBoldText(true); mPaintForOtherLrc = new TextPaint(); mPaintForOtherLrc.setAntiAlias(true); mPaintForOtherLrc.setColor(mColorForOtherLrc); mSizeForOtherLrc = size; mPaintForOtherLrc.setTextSize(mSizeForOtherLrc); mPaintForTimeLine = new TextPaint(); mPaintForTimeLine.setAntiAlias(true); mSizeForTimeLine = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 11, getContext().getResources().getDisplayMetrics()); mPaintForTimeLine.setTextSize(mSizeForTimeLine); mPaintForTimeLine.setColor(mTimeLineColor); mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); }
Example 16
Source File: TextAppearanceSpan.java From JotaTextEditor with Apache License 2.0 | 5 votes |
@Override public void updateMeasureState(TextPaint ds) { if (mTypeface != null || mStyle != 0) { Typeface tf = ds.getTypeface(); int style = 0; if (tf != null) { style = tf.getStyle(); } style |= mStyle; if (mTypeface != null) { tf = Typeface.create(mTypeface, style); } else if (tf == null) { tf = Typeface.defaultFromStyle(style); } else { tf = Typeface.create(tf, style); } int fake = style & ~tf.getStyle(); if ((fake & Typeface.BOLD) != 0) { ds.setFakeBoldText(true); } if ((fake & Typeface.ITALIC) != 0) { ds.setTextSkewX(-0.25f); } ds.setTypeface(tf); } if (mTextSize > 0) { ds.setTextSize(mTextSize); } }
Example 17
Source File: EditProfilePage.java From fanfouapp-opensource with Apache License 2.0 | 4 votes |
private void setFakedBold(final TextView tv) { final TextPaint tp = tv.getPaint(); tp.setFakeBoldText(true); }
Example 18
Source File: UserInfoFragment.java From iBeebo with GNU General Public License v3.0 | 4 votes |
private void displayBasicInfo() { HeaderPagerAdapter adapter = new HeaderPagerAdapter(); viewPager.setAdapter(adapter); friendsCount.setText(Utility.convertStateNumberToString(getActivity(), userBean.getFriends_count())); fansCount.setText(Utility.convertStateNumberToString(getActivity(), userBean.getFollowers_count())); weiboCount.setText(Utility.convertStateNumberToString(getActivity(), userBean.getStatuses_count())); TextPaint tp = nickname.getPaint(); tp.setFakeBoldText(true); if (TextUtils.isEmpty(userBean.getRemark())) { nickname.setText(userBean.getScreen_name()); } else { nickname.setText(userBean.getScreen_name() + "(" + userBean.getRemark() + ")"); } // getBaseToolbar().setTitle(userBean.getScreen_name()); avatar.checkVerified(userBean); if (!userBean.isVerified()) { rightPoint.setVisibility(View.GONE); } else { rightPoint.setVisibility(View.VISIBLE); } avatar.getImageView().post(new Runnable() { @Override public void run() { TimeLineBitmapDownloader.getInstance().display(avatar.getImageView(), avatar.getImageView().getWidth(), avatar.getImageView().getHeight(), userBean.getAvatar_large(), FileLocationMethod.avatar_large); } }); // TimeLineBitmapDownloader.getInstance().downloadAvatar(avatar.getImageView(), // userBean, (AbstractTimeLineFragment) this); avatar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String path = FileManager.getFilePathFromUrl(userBean.getAvatar_large(), FileLocationMethod.avatar_large); if (!ImageUtility.isThisBitmapCanRead(path)) { path = FileManager.getFilePathFromUrl(userBean.getAvatar_large(), FileLocationMethod.avatar_small); if (!ImageUtility.isThisBitmapCanRead(path)) { return; } } Rect rect = AnimationUtility.getBitmapRectFromImageView(avatar); UserAvatarDialog dialog = UserAvatarDialog.newInstance(path, rect); dialog.show(getFragmentManager(), ""); } }); if (!TextUtils.isEmpty(userBean.getDescription())) { bio.setText(userBean.getDescription()); bio.setVisibility(View.VISIBLE); } else { bio.setVisibility(View.GONE); } if (!TextUtils.isEmpty(userBean.getLocation())) { location.setText(userBean.getLocation()); location.setVisibility(View.VISIBLE); } else { location.setVisibility(View.GONE); } if (!TextUtils.isEmpty(userBean.getUrl())) { url.setText(userBean.getUrl()); TimeLineUtility.addLinks(url); url.setVisibility(View.VISIBLE); } else { url.setVisibility(View.GONE); } if (userBean.isVerified()) { verifiedReason.setVisibility(View.VISIBLE); verifiedReason.setText(userBean.getVerified_reason()); } else { verifiedReason.setVisibility(View.GONE); } if (userBean.isFollow_me()) { followsYou.setVisibility(View.VISIBLE); followsYou.setText(getString(R.string.is_following_me) + "@" + BeeboApplication.getInstance().getCurrentAccountName()); } else { followsYou.setVisibility(View.GONE); } }
Example 19
Source File: StrongEmphasisSpan.java From Markwon with Apache License 2.0 | 4 votes |
@Override public void updateDrawState(TextPaint tp) { tp.setFakeBoldText(true); }
Example 20
Source File: TextAppearanceSpan.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override public void updateMeasureState(TextPaint ds) { final Typeface styledTypeface; int style = 0; if (mTypeface != null) { style = mStyle; styledTypeface = Typeface.create(mTypeface, style); } else if (mFamilyName != null || mStyle != 0) { Typeface tf = ds.getTypeface(); if (tf != null) { style = tf.getStyle(); } style |= mStyle; if (mFamilyName != null) { styledTypeface = Typeface.create(mFamilyName, style); } else if (tf == null) { styledTypeface = Typeface.defaultFromStyle(style); } else { styledTypeface = Typeface.create(tf, style); } } else { styledTypeface = null; } if (styledTypeface != null) { int fake = style & ~styledTypeface.getStyle(); if ((fake & Typeface.BOLD) != 0) { ds.setFakeBoldText(true); } if ((fake & Typeface.ITALIC) != 0) { ds.setTextSkewX(-0.25f); } ds.setTypeface(styledTypeface); } if (mTextSize > 0) { ds.setTextSize(mTextSize); } }