android textView调整字体的间距和行间距
来源:互联网 发布:做数据与嵌入式 编辑:程序博客网 时间:2024/05/22 16:38
今天,就随便写的textView的内容。
字间距
textView有一个属性android:textScaleX是调节字间距的,它的值是一个float型。查看源代码,默认textView 此属性是使用的是:
android.internal.R.styleable.TextView_textScaleX
setTextScaleX(a.getFloat(attr, 1.0f));
这个用了之后我们发现,textScaleX不是调整字间距的,而是调整字的水平拉申。
行间距
Android系统中TextView默认显示中文时会比较紧凑,不是很美观。为了让每行保持一定的行间距,可以设置属性android:lineSpacingExtra或android:lineSpacingMultiplier。
关于Android下TextView中文换行问题,可查看Android自定义view-文本自动换行。
1、android:lineSpacingExtra
设置行间距,如”3dp”。
2、android:lineSpacingMultiplier
设置行间距的倍数,如”1.2″。
参考代码:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="3dp"
android:lineSpacingMultiplier="1.5"
android:textStyle="bold" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="3dp"
android:lineSpacingMultiplier="1.5"
android:textStyle="bold" />
其实内容很简单,大家自己可以去查找资料。
android textView调整字体的间距和行间距 就讲完了。
就这么简单
阅读全文
1 0
- android textView调整字体的间距和行间距
- Android TextView行间距,字体间距
- Android TextView行间距,字体间距
- Android TextView 设置字间距和行间距
- TextView设置字间距和行间距
- 设置TextView字间距和行间距
- iOS 调整一个label 上的字体间距与行间距
- Android TextView中字体行间距的设置
- android textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- android-textview设置字体的行距和字间距
- android textview设置字体的行距和字间距
- 上班第一天
- Android开发工具入过的坑
- R语言使用支持向量机完成数据分类(SVM)
- 部署上线的最常用的linux指令及步骤
- 非常规最短路(HDU 5335,Walk Out)
- android textView调整字体的间距和行间距
- python 判断字符串是否为整数或负数
- 关于setdrawerlistener过时的解决办法
- 深度学习 —— LSTM
- iOS11中Siri将内置翻译功能,说话语气更自然
- L1-002. 打印沙漏
- 长哥与丽爷--肆
- 单例模式
- ToolBar的再使用