안드로이드 앱 만들기

Text View 만들기

khon98 2020. 7. 25. 19:49

LinearLayout - 모든 자식 뷰들을 한 방향으로(세로 또는 가로) 지정하는 레이아웃을 의미 orientation을 지정해야 함

 

orientation - 방향을 의미

vertical - 세로를 의미

 

width - 가로를 의미

height - 세로를 의미

 

가로(width)match_parent(부모를 의미) 입력

세로(height)wrap_content(텍스트 크기 만큼 세로 길이를 감싸라 라는 의미) 입력

텍스트 사이즈 단위는 sp

 

activity_main.xml

-----------------------------------------------

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmls:android="http://schemas.android.com/apk/res/android"

      xmls:app="http://schemas.android.com/apk/res-auto"

      xmls:tools="http://schemas.android.com/tools"

      android:layout_width="match_parent"

      android:layout_height="match_parent"

      android:orientation="vertical"

      tools:context=".MainActivity">

 

      <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:textColor="#03E2FF"

            android:textSize="20sp"

            android:text="khon98"/>

 

      <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:textColor="#076057"

            android:textSize="40sp"

            android:text="khon01"/>

 

 

 

 

</LinearLayout>

-----------------------------------------------