[Android]안드로이드 스튜디오 TextView (텍스트뷰) 사용하기

    안드로이드 스튜디오 TextView (텍스트뷰) 사용하기

    <?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"    //부모를 안벗어나게 너비 최대화
    android:layout_height="match_parent"   //부모를 안벗어나게 높이 최대화
    android:background="#FFFF00"       //배경 노란색으로 지정
    tools:context=".MainActivity">
    
    <TextView
    android:id="@+id/brother"             //TextView의 아이디를 brother로 지정
    android:layout_width="wrap_content"       // 컨첸츠에 맞게 너비 최소화
    android:layout_height="wrap_content"      // 컨첸츠에 맞게 높이 최소화
    android:text="Hello World!"                   //출력할 문자
    android:textSize="28dp"                         //문자 크기
    android:textColor="#FF0000"                   //문자 색상  빨강색
    android:background="#0000FF"               //텍스트뷰 색상 파랑으로 지정
    app:layout_constraintBottom_toBottomOf="parent"    //부모를 기준으로 맞춘다.
    app:layout_constraintLeft_toLeftOf="parent"              //부모를 기준으로 맞춘다.
    app:layout_constraintRight_toRightOf="parent"           //부모를 기준으로 맞춘다.
    app:layout_constraintTop_toTopOf="parent" />           //부모를 기준으로 맞춘다.
    
    </android.support.constraint.ConstraintLayout>

     

    출력 이미지 

     

    댓글

    Designed by JB FACTORY