[펌] RelativeLayout의 alignBaseline과 alignBottom의 차이

RelativeLayout의 alignBaseline과 alignBottom의 차이가 궁금해서 검색하다가 유용한 정보를 확인하게 되어 모아둔다.
아래와 같은 고민을 했던 적이 있는데, 이런식으로 정렬이 가능하단걸 알게 되었으니, 앞으로 참 잘 쓸 수 있을 듯 하다.

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.

Warning

If you're not careful, using alignBaseline could make your layout look like this: 
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.

출처 : http://stackoverflow.com/questions/21144227/whats-the-difference-between-alignbaseline-and-alignbottom-in-android

댓글

이 블로그의 인기 게시물

[Android] DataBinding의 동작방식 - 4. include Tag 혹은 ViewStub 사용시의 Binding

[Android] Retrofit2, OkHttpClient Method 정리

[Android] Layout별 성능 비교[Measure 호출횟수 비교] (LinearLayout vs RelativeLayout vs ConstraintLayout)