Android控制文字水平间距android:letterSpacing

附录文章1实现的是Android的文字在水平方向的缩放,然而不是水平方向的文字间距。如果要想实现Android TextView之类的文字保持间距,那么需要设置android:letterSpacing,android:letterSpacing的值是一个浮点数,为标准字体的倍数作为间距。写一个小demo示例。
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">    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="Zhang Phil CSDN 默认" />    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:letterSpacing="0.1"        android:text="Zhang Phil CSDN 0.1" />    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:letterSpacing="0.2"        android:text="Zhang Phil CSDN 0.2" />    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:letterSpacing="0.3"        android:text="Zhang Phil CSDN 0.3" />    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:letterSpacing="0.4"        android:text="Zhang Phil CSDN 0.4" />    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:letterSpacing="0.5"        android:text="Zhang Phil CSDN 0.5" /></LinearLayout>


代码运行结果:


附录文章:
1,《Android控制水平方向字体缩放android:textScaleX》链接地址:http://blog.csdn.net/zhangphil/article/details/51306064

更多相关文章

  1. android程序在Layout中设置控件水平或垂直居中
  2. Android(安卓)TextView 文字居中
  3. Android中TextView中加图片,超链接,部分字或者背景变色。。。不断
  4. Android修改Gallery页面布局
  5. Android(安卓)实现显示文字的Gallery
  6. android:text 文字阴影设置
  7. android radiogroup样式(设置切换背景与文字颜色)
  8. ListView设置分隔线间距及按下透明
  9. android - TextView单行显示...或者文字左右滚动(走马灯效果)

随机推荐

  1. network: Android(安卓)网络判断(wifi、3G
  2. 全局窗口二
  3. Android(安卓)定时启动应用
  4. Android(安卓)可滚动圆形进度条 滑块和进
  5. android常用
  6. android判断手机有没有安装微博
  7. Android(安卓)Activity sleep 自线程更新
  8. Android(安卓)实现Activity后台运行
  9. android studio 用cmake编译报错
  10. Android读取XML文件(SAX)