List of usage examples for android.text TextPaint setFakeBoldText
public void setFakeBoldText(boolean fakeBoldText)
From source file:cn.wjh1119.bestnews.ui.fragment.DetailFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data != null && data.moveToFirst()) { //?????view FetchDetailDataFromSqlTask fetchDetailDataFromSqlTask = new FetchDetailDataFromSqlTask(); fetchDetailDataFromSqlTask/* ww w. j a va 2 s . c o m*/ .setOnDataFinishedListener(new FetchDetailDataFromSqlTask.OnDataFinishedListener() { @Override public void onDataSuccessfully(HashMap data) { String title = data.get("title").toString(); String source = data.get("source").toString(); String pubDate = data.get("pubDate").toString(); String content = data.get("content").toString(); String link = data.get("link").toString(); // BitmapDrawable drawable = (BitmapDrawable) data.get("drawable"); Object imageTextFromSql = data.get("imageUrl"); String imageUrl = null; if (imageTextFromSql != null) { imageUrl = data.get("imageUrl").toString(); } mTitleView.setText(title); mTitleView.setFocusable(true); mTitleView.setFocusableInTouchMode(true); mTitleView.requestFocus(); TextPaint paint = mTitleView.getPaint(); paint.setFakeBoldText(true); mSourceView.setText(source); mPubDateView.setText(pubDate); mContentView.setText(content); if (imageUrl != null) { Bitmap bitmap = imageManager.showCacheBitmap(imageUrl); if (bitmap != null) { mImageView.setImageBitmap(bitmap); } else { imageManager.downloadImage(imageUrl, new ImageManager.onImageLoaderListener() { @Override public void onImageLoader(Bitmap bitmap, String url) { if (bitmap != null) { mImageView.setImageBitmap(bitmap); } else { mImageView.setImageResource(R.mipmap.picture_fail_loading); } } }); } } SpannableStringBuilder ssb = new SpannableStringBuilder("??"); ssb.setSpan(new URLSpan(link), 0, ssb.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); ForegroundColorSpan span = new ForegroundColorSpan(Color.BLUE); ssb.setSpan(span, 0, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mLinkView.setText(ssb); // ??MovementMethod mLinkView.setMovementMethod(LinkMovementMethod.getInstance()); // ??ClickableSpan mLinkView.setHighlightColor(0xff8FABCC); } @Override public void onDataFailed() { } }); fetchDetailDataFromSqlTask.execute(data); } AppCompatActivity activity = (AppCompatActivity) getActivity(); Toolbar toolbarView = (Toolbar) getView().findViewById(R.id.toolbar_detail); // We need to start the enter transition after the data has loaded if (mTransitionAnimation) { activity.supportStartPostponedEnterTransition(); if (null != toolbarView) { activity.setSupportActionBar(toolbarView); activity.getSupportActionBar().setDisplayShowTitleEnabled(false); activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); } } else { if (null != toolbarView) { Menu menu = toolbarView.getMenu(); if (null != menu) menu.clear(); } } }
From source file:com.stx.xhb.dmgameapp.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(!tabSwitch ? tabBackgroundResId : transparentColorId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); TextPaint tp = tab.getPaint(); tp.setFakeBoldText(false); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabSwitch && i != 0 ? tabDeactivateTextColor : tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }// ww w .j ava 2s . c o m } } else if (v instanceof ImageButton) { ImageButton tab = (ImageButton) v; tab.setSelected(tabSwitch && i == 0 ? true : false); } } }