개발/안드로이드(Android-Kotlin)

LinearLayout same width

개복치 개발자 2019. 9. 28. 10:23

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:weightSum="4"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="1"/>

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="2"/>

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="3"/>

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="4"/>

</LinearLayout>

위의 그림처럼, 똑같은 사이즈로 4등분 하는 방법입니다.

 

weight 라는 것을 이용해서 구현합니다.

 

위의 코드 참고하시면 됩니다 :)

'개발 > 안드로이드(Android-Kotlin)' 카테고리의 다른 글

Cannot fit requested classes in a single dex file  (0) 2019.10.01
Android Design Pattern (MVC, MVP, MVVM)  (0) 2019.09.28
textView setTextSize  (0) 2019.09.28
CircleImageView  (0) 2019.09.27
ViewPager Tablayout  (0) 2019.09.26