1.跟据宽度设置文本大小
/*** @param textView 根据 固定宽度 设置字体大小* @param text 显示文本*/public void setTextAutoSize(TextView textView, String text) {ViewGroup.LayoutParams layoutParams = textView.getLayoutParams();layoutParams.width = (int) TypedValue.applyDimension(PLEX_UNIT_DIP, 100f, getResources().getDisplayMetrics());//必须明确 TextView的宽度(注意:实际宽度跟所在布局有关系)textView.setLayoutParams(layoutParams);float drawWidth = (layoutParams.width - textView.getPaddingLeft() - textView.getPaddingRight())*0.95f;// 计算 显示宽度(取控件宽度的 95%,不要取全部宽度,防止显示不全问题)TextPaint textPaint = textView.getPaint();float defTextWidth = textPaint.measureText(text);float proportion = drawWidth / defTextWidth;//计算 字体大小比例SpannableString spannableString = new SpannableString(text);spannableString.setSpan(new Rel