자신의 공간을 빼고 나머지 공간을 나눠 갖는 것이다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/button4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Button" />
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
layout_weight를 0dp로 놓고 쓰는 경우가 많다
0dp로 공간을 할당하지 않고 layout_weight으로 나머지 공간을 2:1로 차지 하게 된다.
'Android' 카테고리의 다른 글
Parcelable (0) | 2017.08.01 |
---|---|
PDF 파일을 띄우는 Source (0) | 2017.07.26 |
Inflater (0) | 2017.07.25 |
DatePicker (0) | 2017.07.23 |
Layout 종류별 소스 (0) | 2017.06.08 |