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安装zookeeper集群
版本号: Redhat6.5 zookeeper-3.4.6 JDK1.8 zookeeper下载 官网下载地址:https://mirrors.tuna.tsinghua.edu.cn/apac ...
- 测试ik分词效果
POST: http://192.168.1.12:9200/ddycdr/_analyze?analyzer=ik_max_word body: {"text":& ...
- Centos7 环境下 Python2.7 换成 Python3.7 运行 scrapy 应用所遇到的问题记录
参考网友的安装过程 Linux系统Centos安装Python3.7 设置Python默认为Python3.7 mv /usr/bin/python /usr/bin/python.bak ln -s ...
- xe5 android 调用照相机获取拍的照片[转]
本篇文章我们来看一下delphi xe5 在android程序里怎样启动照相机并获取所拍的照片,本代码取自xe自带打sample,路径为: C:\Users\Public\Documents\RAD ...
- system.Data.Entity.Infrastructure.DbUpdateConcurrencyException: Store update, insert, or delete statement affected an unexpected number of rows (0) 问题
页面控件没有做限制.提交后还可以继续点击,造成了在短时间内的多次请求.查看日志两次错误在200ms之内. 错误信息 system.Data.Entity.Infrastructure.DbUpdate ...
- C 500uS状态机架构
main int main(void) { InitSys(); SoftwareInit(); ) { if(P500usReq) { P500usReq = ; P500us(); } Modbu ...
- BlockingQueue队列
1.BlockingQueue定义的常用方法如下 抛出异常 特殊值 阻塞 超时 插入 add(e) offer(e) put(e) offer(e,time,unit) 移除 remove() ...
- jquery add()方法
<html><meta charset="utf-8"><head><script type="text/javascript& ...
- [UE4]使用name slot制作带背景的容器
name slot相当于asp.net模板中的content模板. 可以往“Name Slot”里面拖放控件,如果没有“Name Slot”就不能给“BgPanel”拖放任何控件
- [UE4]控件模板
控件模板:一个UI可以作为另外一个UI的子控件,这个子控件就是控件模板. 控件模板一般使用“Size Box”组件作为根节点,给“Size Box”组件设置合适的尺寸,显示模式选择“Desired”, ...