android TextView 例子代码(文字中划线、文字下划线)
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="15dp">
<!--给文字添加中划线-->
<TextView
android:id="@+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="给文字添加中划线"
android:textSize="30sp"
android:textColor="#00dd99"
android:layout_marginTop="15dp"/>
<!--给文字添加下划线-->
<TextView
android:id="@+id/TextView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="给文字添加下划线"
android:textSize="30sp"
android:textColor="#00dd99"
android:layout_marginTop="15dp"/>
</LinearLayout>
Activity:
package com.example.prize.mydemo1;
import android.graphics.Paint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class Main5Activity extends AppCompatActivity {
TextView textView1,textView2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main5);
textView1 = (TextView)findViewById(R.id.TextView1);
textView2 =(TextView)findViewById(R.id.TextView2);
textView1.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);//中划线
textView1.getPaint().setAntiAlias(true); //去掉锯齿
textView2.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
}
}
运行效果:
android TextView 例子代码(文字中划线、文字下划线)的更多相关文章
- android TextView 例子代码(文字图片、文字省略、文字滚动)
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- React-Native 之 GD (二十)removeClippedSubviews / modal放置的顺序 / Android 加载git图\动图 / 去除 Android 中输入框的下划线 / navigationBar
1.removeClippedSubviews 用于提升大列表的滚动性能.需要给行容器添加样式overflow:’hidden’.(Android已默认添加此样式)此属性默认开启 这个属性是因为在早期 ...
- iOS - UIButton设置文字标题下划线以及下划线颜色
创建button设置可以折行显示 - (void)viewDidLoad { [super viewDidLoad]; UIButton * button = [[UIButton alloc] in ...
- python中那些双下划线开头得函数和变量--转载
Python中下划线---完全解读 Python 用下划线作为变量前缀和后缀指定特殊变量 _xxx 不能用'from module import *'导入 __xxx__ 系统定义名字 __x ...
- python中那些双下划线开头得函数和变量
Python中下划线---完全解读 Python 用下划线作为变量前缀和后缀指定特殊变量 _xxx 不能用’from module import *’导入 __xxx__ 系统定义名字 __x ...
- SQL搜索下划线,like中不能匹配下划线的问题
最近在检测天气预报15天查询网 站(http://tqybw.net)时的URL时,发现页面中有很些404页,分析发现,是请求地址的能参数中多了下划线“_”,而rewrite规 则中并没有配这样的规则 ...
- json字符串中key值下划线命名转换为驼峰命名
json字符串中key值下划线命名转换为驼峰命名: 例如: 原json串: String json= "{'user_name':'ok','user_sex':0,'object_info ...
- python python中那些双下划线开头的那些函数都是干啥用用的
1.写在前面 今天遇到了__slots__,,所以我就想了解下python中那些双下划线开头的那些函数都是干啥用用的,翻到了下面这篇博客,看着很全面,我只了解其中的一部分,还不敢乱下定义. 其实如果足 ...
- 去掉VS2010代码中文注释的红色下划线
VS2010代码中文注释出现红色下划线,代码看上去很不美观,发现是由于安装Visual Assist X插件造成的. 解决办法:打开VAX的Options对话框,取消Advanced --> U ...
随机推荐
- RedHat6.5安装单机flume1.6
版本号: RedHat6.5 JDK1.8 apache-flume-1.6.0 1.apache-flume-1.6.0-bin.tar.gz 下载 官网下载地址:http://archiv ...
- Excel技巧--分类求和与空白批量填充
分类求和: 当我们要对以上多个分类空白求和时,可以巧用Alt+=键: 1.选择对应要求和的列: 2.点击“查找与选择”下拉列,选择“定位条件”,对话框选择“空值”,点确定.将列中的空白单元格选好: 3 ...
- 瑞萨S5D9实现UART环形缓冲
队列的常见两种形式,普通队列和环形队列: 普通队列: 环形队列: 当有大量数据的时候,我们不能存储所有的数据,那么计算机处理数据的时候,只能先处理先来的,那么处理完后呢,就会把数据释放掉,再处理下一个 ...
- mysql++ 3.2.3 源码安装
https://tangentsoft.com/mysqlpp/home 下载 wget https://tangentsoft.com/mysqlpp/releases/mysql++-3.2.3. ...
- 网页如何检查浏览器是否安装flash插件
如果页面需要加载flash插件并且需要提示用户flash下载,这里有个官方很好的js文件只要引用就可以实现 //v1.7 // Flash Player Version Detection // De ...
- Redis的5中数据类型
Radis的作用相信既然然就就知道她的作用,但是对于刚开始对radis学习的初学者来说,理解起来比较费劲.这里就从开始一步步认识radis 首先要知道radis是存在内存中的数据,所以读取速度回更改, ...
- SSH的配置文件
Hibernate: xxx.hbm.xml ,作用:类的属性和表的列建立映射关系,主键策略,多表查询等 hibernate.cfg.xml ,核心配置文件,数据库配置信息,加载xxx.hbm.x ...
- NodeJs之配置文件管理
查询了一些资料,我使用nodejs的object作为配置文件,首先定义一个module config.js: var config = { uploadPath: "E:\\" } ...
- 学习笔记之Introduction to Data Visualization with Python | DataCamp
Introduction to Data Visualization with Python | DataCamp https://www.datacamp.com/courses/introduct ...
- [转]PLSQL 记住密码