기본적인 레이아웃 관련

Posted by 일빵
2018. 5. 17. 13:55 프로그래밍 구분/안드로이드

안드로이드에서 자주 사용하는 레이아웃과 관련된 글을 정리하면 다음과 같습니다.


1. 제약 레이아웃 - ConstraintLayout

android.support.constraint.ConstraintLayout

https://developer.android.com/reference/android/support/constraint/ConstraintLayout

https://developer.android.com/training/constraint-layout/

https://academy.realm.io/kr/posts/constraintlayout-it-can-do-what-now/

https://www.journaldev.com/13590/android-constraintlayout

입력 코드 및 결과


<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:text="TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textView"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginLeft="16dp"
        android:layout_marginEnd="16dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginRight="16dp" />

</android.support.constraint.ConstraintLayout>



2. 리니어 레이아웃 - LinearLayout


android.widget.LinearLayout


https://developer.android.com/reference/android/widget/LinearLayout


입력 코드 및 결과


3. 상대 레이아웃 - RelativeLayout


입력 코드 및 결과




4. 프레임 레이아웃 - FrameLayout


입력 코드 및 결과


5. 테이블 레이아웃 - TableLayout


입력 코드 및 결과