개발/개발하다가 알게된 것
[안드로이드] 테이블 레이아웃 내부 요소를 너비에 맞추기
미니소곰
2020. 2. 17. 01:50
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/storyActivity_tableLayout"
android:stretchColumns="*"
android:shrinkColumns="*"
>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button/>
<Button/>
<Button/>
<Button/>
<Button/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button/>
<Button/>
<Button/>
<Button/>
</TableRow>
</TableLayout>
stretchColums를 하면 안에 속한 것들을 너비에 맞게 늘리는 것이고
shrinkColums는 너비에 맞게 줄이는 것이다.
다음과 같은 결과가 나온다