List of usage examples for android.graphics Typeface DEFAULT_BOLD
Typeface DEFAULT_BOLD
To view the source code for android.graphics Typeface DEFAULT_BOLD.
Click Source Link
From source file:com.kncwallet.wallet.util.ViewPagerTabs.java
@Override protected void onDraw(final Canvas canvas) { super.onDraw(canvas); final int viewWidth = getWidth(); final int viewHalfWidth = viewWidth / 2; final int viewBottom = getHeight(); final float density = getResources().getDisplayMetrics().density; final float spacing = 32 * density; path.reset();/*w w w.j av a2s. c om*/ path.moveTo(viewHalfWidth, viewBottom - 5 * density); path.lineTo(viewHalfWidth + 5 * density, viewBottom); path.lineTo(viewHalfWidth - 5 * density, viewBottom); path.close(); paint.setColor(Color.TRANSPARENT); canvas.drawPath(path, paint); paint.setTypeface(Typeface.DEFAULT_BOLD); final float y = getPaddingTop() + -paint.getFontMetrics().top; for (int i = 0; i < labels.size(); i++) { final String label = labels.get(i); paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); paint.setColor(i == pagePosition ? Color.WHITE : Color.WHITE); final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset); final float labelWidth = paint.measureText(label); final float labelHalfWidth = labelWidth / 2; final float labelLeft = x - labelHalfWidth; final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth); final float labelRight = x + labelHalfWidth; final float labelVisibleRight = labelRight < viewWidth ? 1f : 1f - ((labelRight - viewWidth) / labelWidth); final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight); paint.setAlpha((int) (labelVisible * 255)); canvas.drawText(label, labelLeft, y, paint); } }
From source file:gr.plushost.prototypeapp.widgets.LabelView.java
private void init() { if (!(getLayoutParams() instanceof ViewGroup.LayoutParams)) { LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); setLayoutParams(layoutParams);/*from ww w. jav a 2 s.c o m*/ } // the default value //setPadding(dip2Px(40), dip2Px(2), dip2Px(40), dip2Px(2)); _labelViewContainerID = -1; setGravity(android.view.Gravity.CENTER); setTextColor(Color.WHITE); setTypeface(Typeface.DEFAULT_BOLD); setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); //setBackgroundColor(Color.BLUE); //setBackground(ContextCompat.getDrawable(getContext(), R.drawable.view_line_dotted)); setBackgroundResource(_drawableRes); }
From source file:com.rachelgrau.rachel.health4theworldstroke.Activities.InfoActivity.java
public void addSubheaderWithText(String text) { LinearLayout ll = (LinearLayout) findViewById(R.id.text_linear_layout); TextView textView = new TextView(this); textView.setTypeface(null, Typeface.BOLD); textView.setText(text);// w w w .ja v a 2 s.c o m textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setPadding(40, 10, 40, 0); textView.setTextSize(16); textView.setBackgroundColor(Color.WHITE); ll.addView(textView); }
From source file:com.acrylicgoat.houstonbicyclemuseum.view.SlidingTabLayout.java
protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); }/*from www . j a v a 2s .co m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.bruno.distribuciones.android.SlidingTabLayout.java
protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true);//from w w w . jav a 2s. co m int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:org.aquabase.DetailsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { View rootView = inflater.inflate(R.layout.fragment_details, container, false); // Fill the table layout with rows for the fields depending on the item TableLayout table = (TableLayout) rootView.findViewById(R.id.TableLayout); for (int i = 0; i < mLabelIds.size(); i++) { // Don't switch to an inflated XML file for each row: way too slow TableRow row = new TableRow(getActivity()); row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); row.setPadding(0, 3, 0, 3);/*from www. j a v a2 s. c om*/ TextView titleView = new TextView(getActivity()); titleView.setText(mLabelIds.get(i)); titleView.setPadding(0, 0, 12, 0); titleView.setGravity(Gravity.TOP); titleView.setTypeface(Typeface.DEFAULT_BOLD); row.addView(titleView); TextView valueView = new TextView(getActivity()); valueView.setText(mValues.get(i)); titleView.setGravity(Gravity.TOP); row.addView(valueView); table.addView(row, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } return rootView; }
From source file:com.hgdendi.contactslist.common.IndexBar.java
/****************** * common/*from ww w . j a v a2 s. c o m*/ ******************/ private void initSetting(Context context, AttributeSet attrs) { mOnTouchingLetterChangeListener = getDummyListener(); mNavigators = new ArrayList<>(0); mFocusIndex = -1; TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.IndexBar); float textSize = typedArray.getDimension(R.styleable.IndexBar_letterSize, 8); int letterColor = typedArray.getColor(R.styleable.IndexBar_letterColor, ContextCompat.getColor(getContext(), android.R.color.white)); mLetterSpacingExtra = typedArray.getFloat(R.styleable.IndexBar_letterSpacingExtra, 1.4f); int focusLetterColor = typedArray.getColor(R.styleable.IndexBar_focusLetterColor, ContextCompat.getColor(getContext(), android.R.color.white)); typedArray.recycle(); mPaint = new Paint(); mPaint.setTypeface(Typeface.DEFAULT_BOLD); mPaint.setAntiAlias(true); mPaint.setColor(letterColor); mPaint.setTextSize(textSize); mFocusPaint = new Paint(); mFocusPaint.setTypeface(Typeface.DEFAULT_BOLD); mFocusPaint.setAntiAlias(true); mFocusPaint.setFakeBoldText(true); mFocusPaint.setTextSize(textSize); mFocusPaint.setColor(focusLetterColor); }
From source file:com.cssweb.android.view.FinanceMini.java
public void drawHKPrice(Canvas canvas) { Paint paint = this.mPaint; paint.setTypeface(Typeface.DEFAULT_BOLD); paint.setAntiAlias(true);//from w w w . j ava2s.c o m if (quoteData != null) { try { JSONArray jArr = quoteData.getJSONArray("data"); JSONObject jo = jArr.getJSONObject(0); paint.setTextAlign(Paint.Align.LEFT); paint.setTextSize(mTextSize); paint.setColor(GlobalColor.colorLabelName); canvas.translate(0, DY); canvas.drawText("?", x, y, paint); canvas.translate(0, DY); canvas.drawText("?", x, y, paint); canvas.translate(0, DY); canvas.drawText("", x, y, paint); canvas.translate(0, DY); canvas.drawText("?", x, y, paint); canvas.translate(0, DY); canvas.drawText("?", x, y, paint); paint.setTextAlign(Paint.Align.RIGHT); paint.setColor(GlobalColor.colorStockName); canvas.translate(width / 2, -DY * 4); canvas.drawText(Utils.getAmountFormat(jo.getInt("cjsl"), false), x - tips, y, paint); canvas.translate(0, DY); // if(jo.getDouble("wb")<0) // paint.setColor(GlobalColor.colorPriceDown); // else if(jo.getDouble("wb")>0) // paint.setColor(GlobalColor.colorpriceUp); // else // paint.setColor(GlobalColor.colorPriceEqual); // canvas.drawText(Utils.dataFormation(jo.getDouble("wb")*100, 1)+"%", x-tips, y, paint); canvas.drawText(Utils.getAmountFormat(jo.getInt("cjje"), false), x - tips, y, paint); paint.setColor(GlobalColor.colorpriceUp); canvas.translate(0, DY); canvas.drawText(Utils.getAmountFormat(jo.getDouble("wp"), false), x - tips, y, paint); paint.setColor(GlobalColor.colorStockName); canvas.translate(0, DY); canvas.drawText(Utils.getAmountFormat(jo.getInt("msgs"), true), x - tips, y, paint); paint.setTextAlign(Paint.Align.LEFT); paint.setColor(GlobalColor.colorLabelName); canvas.translate(0, -DY * 3); canvas.drawText("?", x, y, paint); canvas.translate(0, DY); // canvas.drawText("", x, y, paint); canvas.drawText("", x, y, paint); canvas.translate(0, DY); canvas.drawText("", x, y, paint); // canvas.translate(0, DY); // canvas.drawText("?", x, y, paint); canvas.translate(0, DY); canvas.drawText("", x, y, paint); paint.setTextAlign(Paint.Align.RIGHT); canvas.translate(width / 2, -DY * 3); paint.setColor(GlobalColor.colorStockName); canvas.drawText(Utils.dataFormation(jo.getDouble("lb"), 1, jo.getInt("tp")), x - tips, y, paint); canvas.translate(0, DY); // if(jo.getDouble("wc")<0) { // paint.setColor(GlobalColor.colorPriceDown); // canvas.drawText("-" + Utils.getAmountFormat(Math.abs(jo.getDouble("wc")), true), x-tips, y, paint); // } // else if(jo.getDouble("wc")>0) { // paint.setColor(GlobalColor.colorpriceUp); // canvas.drawText(Utils.getAmountFormat(jo.getDouble("wc"), true), x-tips, y, paint); // } // else { // paint.setColor(GlobalColor.colorPriceEqual); // canvas.drawText(Utils.getAmountFormat(jo.getDouble("wc"), true), x-tips, y, paint); // } paint.setColor(GlobalColor.colorPriceDown); canvas.drawText("", x - tips, y, paint); canvas.translate(0, DY); canvas.drawText(Utils.getAmountFormat(jo.getDouble("np"), false), x - tips, y, paint); // paint.setColor(GlobalColor.colorStockName); // canvas.translate(0, DY); // canvas.drawText(Utils.getAmountFormat(jo.getDouble("cjje"), true), x-tips, y, paint); } catch (JSONException e) { Log.e(TAG, e.toString()); } } }
From source file:com.android.mail.browse.SendersView.java
public static Typeface getTypeface(boolean isUnread) { return isUnread ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT; }
From source file:de.dev.eth0.android.sample.navigationDrawer.view.slidingtab.SlidingTabLayout.java
/** * Creates the textview for a single entry. * * @param context/*ww w .j a va 2 s . co m*/ * @param isActive * @return the textview */ protected TextView createTabView(Context context, boolean isActive) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setTextColor(Color.WHITE); if (!isActive) { textView.setAlpha(0.5f); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }