zoukankan      html  css  js  c++  java
  • TextView划线 android

    TextView  加下划线 、 中划线

    下过如图:

     

    // 中划线

    textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰

    // 下划线

    textView.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);


    //取消设置的线

    textView.getPaint().setFlags(0); // 取消设置的的划线


    我封装了几个方法  直接调用

     

    	/**
    	 * 下划线
    	 * 
    	 * @param textView
    	 */
    	private void addButtomLine(TextView textView) {
    		textView.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
    	}
    
    	/**
    	 * 移除线
    	 * 
    	 * @param textView
    	 */
    	private void removeLine(TextView textView) {
    		textView.getPaint().setFlags(0); // 取消设置的的划线
    
    	}
    
    	/**
    	 * 设置中划线并加清晰
    	 * 
    	 * @param textView
    	 */
    	private void addLine(TextView textView) {
    		textView.getPaint().setFlags(
    				Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰
    
    	}
    
    	/**
    	 * 中划线
    	 * 
    	 * @param textView
    	 */
    	private void addCenterLine(TextView textView) {
    		textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); // 中划线
    	}
    
    	/**
    	 * 抗锯齿
    	 * 
    	 * @param textView
    	 */
    	private void addjuchiLine(TextView textView) {
    		textView.getPaint().setAntiAlias(true);// 抗锯齿
    	}


     

  • 相关阅读:
    Codeforces 50A
    Codeforces 50A
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
    Python Ethical Hacking
  • 原文地址:https://www.cnblogs.com/yfceshi/p/6826002.html
Copyright © 2011-2022 走看看