정리노트

[안드로이드 스튜디오/Android_Studio] res \ layout 간단 기본 개념 본문

app/Android_Studio

[안드로이드 스튜디오/Android_Studio] res \ layout 간단 기본 개념

Rolen 2023. 2. 21. 19:22
<?xml version="1.0" encoding="utf-8"?>

<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <!--xmlns:android => XML 파일에서 항상 최외곽 태그는 이 속성을 정의 / 
                            안드로이드 이름공간에 정의된 속성들을 참조함 암시-->
    

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
    <!--android:id => TextView 요소에 유일한 아이디 할당. 해당 id로 텍스트 뷰 참조할 수 있음
        android:layout_width => 폭의 범위 정의 / match_parent 는 부모 화면의 폭을 전부 차지
        android:layout_height => 높이의 범위 정의 / wrap_parent 는 콘텐츠 표시할 정도만 차지
        android:text => 화면에 표시하는 텍스트 설정 -->

</androidx.constraintlayout.widget.ConstraintLayout>
728x90