android:baselineAligned="false"

android:baselineAligned 设置子元素都按照基线对齐,默认是true
霍,完蛋,看着这个定义我懵了,必须得试一试,才能理解,话不多说,开撸代码吧!

在这里插入图片描述
注:此图片来源于其它博文。类似图片较多,找不到原出处,如有侵权,联系删除。

当android:baselineAligned="true"时候,

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:baselineAligned="true"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/view1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dip"
        android:text="haosy" />
    <TextView
        android:id="@+id/view2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dip"
        android:textSize="30sp"
        android:text="河南济源追梦孩"
        />
</LinearLayout>

效果如图
在这里插入图片描述
当android:baselineAligned="false"时候,
在这里插入图片描述
可以看到设置为false的时候基线不对齐,具体怎么定义,这在我看来不重要,实践出真知,只有自己动手试一试才能品出这细微差距。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值