/** * 设置标签字体大小 * * @param textSize 字体大小 */ public void setLabelTextSize(float textSize) { mYearTv.setTextSize(textSize); mMonthTv.setTextSize(textSize); mDayTv.setTextSize(textSize); }
ItemView(AppCompatTextView textView) { super(textView); this.textView = textView; textView.setTextSize(12f); } }
/** * Reset the text to the original size */ public void resetTextSize() { if (mTextSize > 0) { super.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); mMaxTextSize = mTextSize; } }
/** * 设置标签字体大小 * * @param unit 单位 * @param textSize 字体大小 */ public void setLabelTextSize(int unit, float textSize) { mYearTv.setTextSize(unit, textSize); mMonthTv.setTextSize(unit, textSize); mDayTv.setTextSize(unit, textSize); }
/** * Override the set text size to update our internal reference values */ @Override public void setTextSize(float size) { super.setTextSize(size); mTextSize = getTextSize(); }
/** * Override the set text size to update our internal reference values */ @Override public void setTextSize(int unit, float size) { super.setTextSize(unit, size); mTextSize = getTextSize(); }
/** * Modifies size of text in side CCP view. * * @param textSize size of text in pixels */ public void setTextSize(int textSize) { if (textSize > 0) { mTvSelectedCountry.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); setArrowSize(textSize); setFlagSize(textSize); } }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.permission_rationale, container, false); AppCompatTextView rationaleView = (AppCompatTextView) rootView.findViewById(R.id.permission_text); rationaleView.setText(getArguments().getString(TEXT_KEY)); rationaleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getArguments().getFloat(TEXT_SIZE)); rationaleView.setTextColor(getArguments().getInt(TEXT_COLOR)); rationaleView.setTypeface(Typeface.createFromAsset(getResources().getAssets(), "fonts/" + getArguments().getString(TEXT_FONT))); return rootView; } }
private static AlertDialog createDialog(final Context context) { AppCompatTextView messageTextView = new AppCompatTextView(context); messageTextView.setTextSize(16f); messageTextView.setText(context.getString(R.string.download_manager_disabled)); messageTextView.setPadding(50, 50, 50, 0); messageTextView.setTextColor(ContextCompat.getColor(context, R.color.black)); return new AlertDialog.Builder(context) .setView(messageTextView) .setPositiveButton("ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { enableDownloadManager(context); } }) .setCancelable(false) .create(); }
@Override public View getDropDownView(int position, View convertView, ViewGroup parent) { AppCompatTextView ret = new AppCompatTextView(parent.getContext()); ret.setText(displayText[position]); ret.setTextSize(16); ret.setPadding(0, 10, 0, 10); ret.setTextColor(Color.BLACK); return ret; }
@Override public View getView(int position, View convertView, ViewGroup parent) { AppCompatTextView ret = new AppCompatTextView(parent.getContext()); ret.setText(displayText[position]); ret.setTextSize(16); ret.setPadding(0, 10, 0, 10); ret.setTextColor(Color.BLACK); return ret; }
private AlertDialog createExitDialog() { AppCompatTextView messageTextView = new AppCompatTextView(this); messageTextView.setTextSize(16f); messageTextView.setText(getString(R.string.really_quit_question)); messageTextView.setPadding(50, 50, 50, 0); messageTextView.setTextColor(ContextCompat.getColor(this, R.color.black)); return new AlertDialog.Builder(this) .setView(messageTextView) .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }) .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // nothing to do here } }) .setCancelable(true) .create(); }
mTvSelectedCountry.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); setFlagSize(textSize); setArrowSize(textSize);
private void initRightOverlayTextView(int color) { mTvRightOverlay = new AppCompatTextView(mContext); mTvRightOverlay.setBackgroundResource(R.drawable.bg_right_overlay); mTvRightOverlay.setSupportBackgroundTintList(ColorStateList.valueOf(color)); mTvRightOverlay.setTextColor(Color.WHITE); mTvRightOverlay.setTextSize(38); mTvRightOverlay.setGravity(Gravity.CENTER); int size = IndexBar.dp2px(mContext, 72); LayoutParams params = new LayoutParams(size, size); params.rightMargin = IndexBar.dp2px(mContext, 33); params.gravity = Gravity.RIGHT; mTvRightOverlay.setLayoutParams(params); mTvRightOverlay.setVisibility(INVISIBLE); }