[안드로이드] Textview

Park Sunjoo·2022년 6월 3일
0
post-thumbnail
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#DC7777"
        android:textSize="20sp"
        android:text="헤이유고걸" />
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="다라다라닷닷 뎃 걸"
        android:textColor="#396A81"
        />
</LinearLayout>

LinearLayout

안드로이드 레이아웃을 만들때 가장 자주사용하는 레이아웃이다.
android:orentation 속성으로 레이아웃 방향을 지정할 수 있다.
vertical: 수직방향
horizontal: 수평방향

match_parent

부모레이아웃에 맞춰 디바이스 전체 화면을 차지한다

wrap_content

컨텐츠 크기에 맞추어 설정된다


 		<TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

(편의성을 위해 layout부분만 떼옴.)


width는 match_parent로 가로부분이 화면전체를 차지한다.
height는 wrap_content로 세로부분이 글자만큼을 차지한다.


결과화면

profile
개발, 디자인에 관심있는 문어발

0개의 댓글