IT/Android
fill_parent와 Wrap_content의 차이
도토리세상
2011. 10. 26. 14:11
레이아웃을 구성하는 프로퍼티들 중에서 Layout width 항목과 Layout height 항목이 취하는 값 중에서 fill_parent 와 wrap_content 의 차이를 계속 헷갈려하다가 이렇게 포스팅을 해둔다.

출처 : http://griper.tistory.com/entry/fillparent-와-wrapcontent-의-차이
- fill_parent : 부모가 가지는 길이를 모두 채울 때 사용한다. 즉, 해당 레이아웃을 취하는 컨테이너의 길이를 모두 채우는 것이다
- wrap_content : 해당 뷰가 그려질 수 있게 필요한 길이만 사용한다. 이 경우 절대적인 값도 넣을 수 있는데, 10px, 10dp, 10sp 처럼 수치와 단위를 써서 직접 길이 값을 지정하면 된다.
다음은 Linear_layout 안의 Button 을 가지고 fill_parent와 wrap_content를 비교해본 것이다.