android:baselineAligned属性
对于可以显示文字的View(如TextView,Button等),它的baseline 指的是这个UI控件中文字Text的baseline 到UI控件顶端的偏移值,可以通过View 的getBaseline()返回,如果一个View不支持baseline 对齐(比如ImageView) getBaseline()返回-1.
LinearLayout 带有一个属性android:baselineAligned 其缺省为true,也就是当使用android:orientation 为horizontal ,其子View的baseline 是对齐的,表现在不同View显示的文字的baseline是对齐的。
如本例: 在顶部显示 TextView, Button ,TextView 文字的基准线(baseline)是对齐的。
可以将android:baselineAligned 设为false 做个比较:
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”horizontal”
android:baselineAligned=”false”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”3dip”
android:text=”@string/baseline_1_label” />
<Button
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginRight=”3dip”
android:text=”@string/baseline_1_button” />
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”20sp”
android:text=”@string/baseline_1_bigger” />
</LinearLayout>
最新文章
- phpunit测试学习 1:一点简单的扼要有用的东西的总结 一点入门认识
- 查看Visual Studio异常内容
- webservice入门(1)
- C#调用有有参有返的存储过程
- web页面实现指定区域打印功能
- 从topcoder赚钱的方法
- RouterOS软路由常用命令
- 新浪微博sdk bug
- 【iOS UISearchBar父控件是UIScrollView时,上移的问题】
- COUNT()函数的使用
- PHP MySQL Update 之 Update
- 关于EL表达式的生效时间(猜想)
- jQuery实例2
- linux网卡配置
- Android简易实战教程--第三十四话《 自定义SeekBar以及里面的一些小知识》
- hibernate框架(2)---Hibernate的核心API
- vue动态class——实现tag的选中状态
- 关于SQL Server将一列的多行内容拼接成一行,合并显示在另外表中
- VUE2 第五天学习--过渡效果
- IntelliJ IDEA连接TFS local workspace无法正常签入
热门文章
- Redis相关指令文档
- No bean named &#39;sessionFactory&#39; is defined
- QueryError:Incorrect result size: expected 1, actual 0
- C# 图解教程 第二章 C#编程概述
- 【Luogu1291】百事世界杯之旅(动态规划,数学期望)
- bzoj2157
- Couldn&#39;t save uncommitted changes.
- 极重要基础命令三剑客加find
- 【noip模拟】2048
- 进入TP-Link路由器之后利用快捷键F12查看星号路由密码的方法