android:textAppearance 设置文字外观。如“?android:attr/textAppearanceLargeInverse ”这里引用的是系统自带的一个外观,?表示系统是否有这种外观,不然使用默认的外观。可设置的值以下:textAppearanceButton/textAppearanceInverse/textAppearanceLarge/textAppearanceLargeInverse/textAppearanceMedium/textAppearanceMediumInverse/textAppearanceSmall/textAppearanceSmallInverse textView.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG ); //下划线 textView.getPaint().setAntiAlias(true);//抗锯齿 textview.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG); //中划线 setFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰 textView.getPaint().setFlags(0); // 取消设置的的划线
自定义建立字型java
//自定义字体字型android
custom=newTextView(this);字体
//字体MgOpenCosmeticaBold.ttf放置于assets/font/路径下this
typeface=Typeface.createFromAsset(getAssets(),"font/MgOpenCosmeticaBold.ttf");spa
custom.setTypeface(typeface);code
custom.setText("Custom Font FYI");get
custom.setTextSize(20.0f);
class
//设置字体颜色引用
custom.setTextColor(Color.CYAN);di
linearLayout.addView(custom,newLinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));