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);// 抗锯齿
    	}


     

  • 相关阅读:
    hdu 2001 计算两点的距离
    hdu 2001 计算两点的距离
    hdu 2000 ASCII码排序(c语言)
    hdu 2000 ASCII码排序(c语言)
    1.网页学习-开始学习第一步:
    .net 父窗口线程交给子窗口
    多线程传递多个参数
    not Exists的使用方法
    xml.dom.minidom介绍
    .net之线程控件之间访问
  • 原文地址:https://www.cnblogs.com/yfceshi/p/6826002.html
Copyright © 2011-2022 走看看