Android 中的 alignBaseline 和 alignBottom 有什么区别? [英] What's the difference between alignBaseline and alignBottom in Android?

查看:44
本文介绍了Android 中的 alignBaseline 和 alignBottom 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试对齐几个 TextView 对象,它们给了我相同的结果.'baseline' 和 'bottom' 之间究竟有什么区别?

解决方案

为了可视化差异,我通常会在 Word 或 Photoshop 中想象两个文本框.

  • 是一个排版术语,指的是不可见的线条文字

    (参考

    我不知道你是否还在寻找答案,但我决定至少把它放在那里,因为这是第一个结果.

    I tried both to align a few TextView objects and they gave me the same results. What exactly is the difference between 'baseline' and 'bottom' ?

    解决方案

    To visualize the difference, I usually imagine two textboxes in Word or Photoshop.

    • alignBottom lines up the bottom of the textboxes. (The blue outline)
      • Text could be uneven, but the boxes they're in would line up on the bottom.
    • alignBaseline aligns the actual text within the box. This can help ensure that the texts line up on the bottom, regardless of font size or textbox size. (The green line)

    What is a Baseline?

    Baseline is a typography term that refers to the invisible line text is written on.

    (As referenced in What is the baseline in RelativeLayout?)

    Warning

    If you're not careful, using alignBaseline could make your layout look like this:

    Details: Watch That Baseline Alignment

    I don't know if you're still looking for the answer, but I decided to at least put this out there since this was one of the first results.

    这篇关于Android 中的 alignBaseline 和 alignBottom 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆