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 ...
随机推荐
- [转]Ubuntu python-config
转自:http://manpages.ubuntu.com/manpages/precise/man1/python-config.1.html recise (1) python-config.1. ...
- java面试题001
1.指针和函数的关系 这里主要谈指针函数和函数指针,在c中指针函数是返回值为指针的函数:函数指针是指向函数的指针变量. 2.什么是事务? 为了完成对数据的操作,要求并发访问在多个构件之间共享的数据.这 ...
- button高度改变
代码:<input type="button" name="submit" value="submit" /> 利用css改变b ...
- 移动互联网终端的touch事件判断方向
var pressX = 0, pressY = 0; document.body.addEventListener('touchmove', function(event) { // 如果这个元素的 ...
- sql server 清除数据库中所有表的数据
CREATE PROCEDURE sp_DeleteAllData AS EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'- ...
- Django--django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE
Django序列化时遇到错误: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESP ...
- 【Java】线程转储分析 ThreadDump
[[TOC]] 通过分析 ThreadDump 来查询Java程序运行情况 获取线程转储文件 有多种方式可以获取转储文件,可参考链接HOW TO TAKE THREAD DUMPS? – 8 OPTI ...
- 廖雪峰Java1-3流程控制-6 do-while循环
do-while循环 do-while先执行循环,再判断条件. 条件满足时继续循环:条件不满足时退出:至少循环1次 int sum =0; int n = 1; do{ sum = sum + n; ...
- Butter Knife 使用方法
获取控件 @InjectView(R.id.image_show_password)ImageView image_show_password; 控件事件 @OnClick(R.id.btn_subm ...
- Win7 无法访问Installer服务
还原系统后,卸载程序时,系统提示"无法访问Windows Installer服务" 一. 可能原因: msi.dll相关的组件未注册: 未开启windows installer服务 ...