TextView 加中划线,下划线,抗锯齿,取消设置的线

public class OneActivity extends Activity{
	private TextView tv1;
	private TextView tv2;
	private TextView tv3;
	private TextView tv4;
	private TextView tv5;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.one_activity);
		
		tv1 = (TextView) findViewById(R.id.tv1);
		tv2 = (TextView) findViewById(R.id.tv2);
		tv3 = (TextView) findViewById(R.id.tv3);
		tv4 = (TextView) findViewById(R.id.tv4);
		tv5 = (TextView) findViewById(R.id.tv5);
		
		tv1.getPaint().setAntiAlias(true);// 抗锯齿
		
		tv2.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); // 中划线
		
		tv3.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线
		
		tv4.getPaint().setFlags(
				Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰

		tv2.getPaint().setFlags(0); // 取消设置的的中划线
		
		
	}
}
TextView 加中划线,下划线,抗锯齿,取消设置的线_第1张图片

你可能感兴趣的:(android,android)