๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Android Studio

[Android ์•ฑ๊ฐœ๋ฐœ ์ž…๋ฌธ] ์œ„์ ฏ (# ์ถ”๊ฐ€ํ•˜๊ธฐ)

by ์ ผ์ ผ39 2024. 3. 18.

1. ์œ„์ ฏ

    : View์˜ ์„œ๋ธŒ ํด๋ž˜์Šค ์ค‘ ํ™”๋ฉด์— ๋ณด์ด๋Š” ๊ฒƒ๋“ค

    - ex. TextView, EditText, Button

 

2. view

    : ๋ชจ๋“  UI ์ปดํฌ๋„ŒํŠธ๋“ค์˜ ๋ถ€๋ชจ ํด๋ž˜์Šค (View ํด๋ž˜์Šค์˜ ์†์„ฑ์€ ๋ชจ๋“  UI ์ปดํฌ๋„ŒํŠธ๋“ค์—์„œ ๊ณตํ†ต์ ์œผ๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅ)

1) id : UI ์ปดํฌ๋„ŒํŠธ๋ฅผ ๊ณ ์œ ํ•˜๊ฒŒ ์‹๋ณ„ํ•˜๋Š” ์‹๋ณ„์ž (์ค‘๋ณต๋  ์ˆ˜ ์—†์Œ)

    (1) ์‹๋ณ„์ž ์ง€์ • ํ˜•์‹

android:id="@+id/my_button"

    (2) ์‹๋ณ„์ž ์ฐธ์กฐ ํ˜•์‹

android:id="@id/my_button"

 

2) layout_width, layout_height

    (1) match_parent ๋˜๋Š” fill_parent : ๋ถ€๋ชจ UI ์ปดํฌ๋„ŒํŠธ์˜ ํฌ๊ธฐ์— ๋งž์ถค

    (2) wrap_content : UI ์ปดํฌ๋„ŒํŠธ์˜ ๋‚ด์šฉ๋ฌผ ํฌ๊ธฐ์— ๋งž์ถค 

    // px (pixel) ํ˜•์‹์œผ๋กœ view์˜ ํฌ๊ธฐ ์„ค์ • ์‹œ ๋””์Šคํ”Œ๋ ˆ์ด ํ•ด์ƒ๋„์— ๋”ฐ๋ผ view์˜ ํฌ๊ธฐ๊ฐ€ ๋‹ฌ๋ผ๋ณด์ž„

    // dp ํ˜•์‹์€ ๋ฐ€๋„์— ๋…๋ฆฝ์ ์ธ ๋‹จ์œ„. 1dp๋Š” ๋ฐ€๋„๊ฐ€ 160dpi์˜ ํ™”๋ฉด์ผ ๋•Œ 1ํ”ฝ์…€์„ ๋‚˜ํƒ€๋ƒ„ (์ž๋™์œผ๋กœ ๋งž์ถฐ์ง)

 

    // ๋‹ค์–‘ํ•œ ํ•ด์ƒ๋„ ๋Œ€์‘ ๋ฐฉ๋ฒ• -> ๋‹ค์–‘ํ•œ ์‚ฌ์ด์ฆˆ์˜ ์ด๋ฏธ์ง€๋ฅผ ์ค€๋น„ํ•ด์„œ (5์žฅ) ๋ชจ๋‘ drawable์— ๋„ฃ์–ด์•ผ ํ•จ

        // 9-PATCH ์ด๋ฏธ์ง€ : ์ด๋ฏธ์ง€๊ฐ€ ๊ทธ๋ ค์งˆ ์˜์—ญ์˜ ํฌ๊ธฐ๊ฐ€ ๋Š˜์–ด๋‚˜๊ฑฐ๋‚˜ ์ค„์–ด๋“ค์–ด๋„ ์›๋ณธ์ด๋ฏธ์ง€ ํ˜•ํƒœ๋ฅผ ์œ ์ง€ํ•˜๋„๋ก ๋œ ๊ฒƒ

 

3. TextView

    : ํ™”๋ฉด์— text๋ฅผ ํ‘œ์‹œํ•˜๋Š” ์šฉ๋„

- ์ฃผ์š” ์†์„ฑ

    1) View ์†์„ฑ ์ƒ์† : id, layout_width, layout_height, background, etc

    2) text : ์ถœ๋ ฅํ•  ๋ฌธ์ž์—ด ์ง€์ •

    3) textSize : ํฐํŠธ ํฌ๊ธฐ

    4) textStyle : ํ…์ŠคํŠธ ์Šคํƒ€์ผ (bold, italic, normal)

    5) typeface : ํ…์ŠคํŠธ ํฐํŠธ (normal, sans, serif, monspace)

    6) textColor : ๋ฌธ์ž์—ด ์ƒ‰์ƒ

    7) singleLine : ์†์„ฑ๊ฐ’์ด "true" ์ด๋ฉด, ํ…์ŠคํŠธ๊ฐ€ ์œ„์ ฏ์˜ ํญ๋ณด๋‹ค ๊ธธ ๋•Œ ๊ฐ•์ œ๋กœ ํ•œ ์ค„์— ์ถœ๋ ฅ

 

4. EditText 

    : ์ž…๋ ฅ์ด ๊ฐ€๋Šฅํ•œ Text์ฐฝ

    - TextView์˜ ๋ชจ๋“  ์†์„ฑ ์ƒ์† (EditText๋Š” TextView์˜ ์„œ๋ธŒํด๋ž˜์Šค)

    - inputType : ์ž…๋ ฅ ์‹œ ํ—ˆ์šฉ๋˜๋Š” ํ‚ค๋ณด๋“œ ํƒ€์ž… ์„ค์ • ๋ฐ ํ‚ค๋ณด๋“œ ํ–‰์œ„๋ฅผ ์„ค์ •

1) ํ‚ค๋ณด๋“œ ํƒ€์ž… ์„ค์ • ๊ฐ’

    (1) "text" : ์ผ๋ฐ˜์ ์ธ ํ…์ŠคํŠธ ํ‚ค๋ณด๋“œ

    (2) "phone" : ์ „ํ™”๋ฒˆํ˜ธ ์ž…๋ ฅ ํ‚ค๋ณด๋“œ

    (3) "textEmailAddress" : @๋ฌธ์ž๋ฅผ ๊ฐ€์ง„ ํ…์ŠคํŠธ ํ‚ค๋ณด๋“œ

2) ํ‚ค๋ณด๋“œ ํ–‰์œ„ ์„ค์ • ๊ฐ’

    (1) "textCapWords" : ๋ฌธ์žฅ์˜ ์‹œ์ž‘์„ ๋Œ€๋ฌธ์ž๋กœ ๋ณ€ํ™˜

    (2) "textAutoCorrect" : ์ž…๋ ฅ๋œ ๋‹จ์–ด์™€ ์œ ์‚ฌํ•œ ๋‹จ์–ด๋ฅผ ์ œ์‹œํ•˜๊ณ  ์ œ์‹œ๋œ ๋‹จ์–ด ์„ ํƒ ์‹œ, ์ž…๋ ฅ๋œ ๋‹จ์–ด๋ฅผ ๋Œ€์น˜

    (3) "textMultiLine" : ์—ฌ๋Ÿฌ ์ค„์„ ์ž…๋ ฅ๋ฐ›์„ ์ˆ˜ ์žˆ์Œ

 

    // background : ๋ทฐ์˜ ๋ฐฐ๊ฒฝ์„ ์ง€์ •, ์ƒ‰์ƒ ๋ฐ ์ด๋ฏธ์ง€ ๋“ฑ์˜ ์—ฌ๋Ÿฌ ๊ฐ์ฒด๋กœ ์ง€์ • ๊ฐ€๋Šฅ

 

5. Button

    : ์‚ฌ์šฉ์ž๊ฐ€ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ์–ด๋–ค ํ–‰๋™์„ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ํ•จ

    - Button ํด๋ž˜์Šค๋Š” TextView์˜ ์„œ๋ธŒํด๋ž˜์Šค. TextView์˜ ๋ชจ๋“  ์†์„ฑ ์‚ฌ์šฉ ๊ฐ€๋Šฅ (ex. singleLine)

    - ๋ฒ„ํŠผ ๋‚ด์— ํ…์ŠคํŠธ, ์•„์ด์ฝ˜ ํ‘œ์‹œ ๊ฐ€๋Šฅ (๋ฒ„ํŠผ ์ „์ฒด๋ฅผ ์ด๋ฏธ์ง€๋กœ ๊ทธ๋ฆฌ๊ธฐ ์œ„ํ•ด์„œ๋Š” ImageButton ์‚ฌ์šฉ)

 

(1) ๋ฒ„ํŠผ ํด๋ฆญ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ• 1 (๋ฒ„ํŠผ ์œ„์ ฏ์˜ onClick ์†์„ฑ ํ™œ์šฉ - doAction())

    : ๋ฒ„ํŠผ ์œ„์ ฏ์„ ์ •์˜ํ•œ ํ™”๋ฉด์„ contentView๋กœ ์„ค์ •ํ•œ ์•กํ‹ฐ๋น„ํ‹ฐ ํด๋ž˜์Šค์— ์ƒˆ๋กœ์šด ๋ฉ”์†Œ๋“œ (ex. doAction() ์ถ”๊ฐ€)
        -> ๋ฒ„ํŠผ ์œ„์ ฏ์„ ์ •์˜ํ•œ xml ๋ ˆ์ด์•„์›ƒ ํŒŒ์ผ(ex. text_views.xml)์—์„œ, ๋ฒ„ํŠผ ์œ„์ ฏ์˜ onClick ์†์„ฑ์— ์•ž ๋‹จ๊ณ„์—์„œ ์ถ”๊ฐ€ํ•œ ๋ฉ”์†Œ๋“œ๋ฅผ ์„ค์ •

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="EditText Test"
        android:textColor="#ff0000"
        android:textSize="10pt"
        android:typeface="serif"
        android:textStyle="bold"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="ID"
        android:inputType="text"
        android:textSize="10pt"
        android:textStyle="italic"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="PassWord"
        android:inputType="textPassword"
        android:textSize="10pt"
        android:textStyle="italic"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Telephone"
        android:inputType="phone"
        android:textSize="10pt"
        android:textStyle="italic"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Email"
        android:inputType="textEmailAddress"
        android:textSize="10pt"
        android:textStyle="italic"/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Description"
        android:inputType="text|textMultiLine|textAutoCorrect"
        android:textSize="10pt"
        android:textStyle="italic"/>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Submit"
        android:onClick="doAction"/> 		//doAction ์‚ฌ์šฉ

</LinearLayout>
package com.example.uibasic

import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.text_views)
//        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
//            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
//            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
//            insets
//        }
    }
    fun doAction(v: View){
        //text_views์—์„œ ๋งŒ๋“  doAction
        Toast.makeText(getApplicationContext(), "Submitted Successfully", Toast.LENGTH_SHORT).show()
    }
}

 

(2) ๋ฒ„ํŠผ ํด๋ฆญ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ• 2 (์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ ๊ฐ์ฒด ์‚ฌ์šฉ)

    : ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑ, ํ•ด๋‹น ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ์œ„์ ฏ์— ๋“ฑ๋ก

    - ์œ„์ ฏ์—์„œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ๋“ฑ๋ก๋œ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ ๊ฐ์ฒด๊ฐ€ ์ •์˜๋œ ์ผ์„ ์ˆ˜ํ–‰ํ•จ

    - ๋ฒ„ํŠผ์ด ํด๋ฆญ๋˜์—ˆ์„ ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ํด๋ฆญ ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด View.OnClickListener ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ํด๋ž˜์Šค๋ฅผ ์ •์˜ -> ๊ตฌํ˜„ํ•œ ํด๋ž˜์Šค์˜ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•ด ํด๋ฆญ ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ๋ฒ„ํŠผ ์œ„์ ฏ์— ๋“ฑ๋ก

    - ๋ฒ„ํŠผ ์œ„์ ฏ์„ ์ •์˜ํ•œ ๋ ˆ์ด์•„์›ƒ ํŒŒ์ผ(ex. text_views.xml)์—์„œ Button ๊ฐ์ฒด๋ฅผ ์ฝ”ํ‹€๋ฆฐ ์ฝ”๋“œ์—์„œ ์ฐธ์กฐํ•˜๊ธฐ ์œ„ํ•ด ๋ฒ„ํŠผ ์œ„์ ฏ์— id์†์„ฑ ์ถ”๊ฐ€

    <Button
        android:id="@+id/submit_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Submit" />
package com.example.uibasic

import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.text_views)

        //text_views.xml์— ์ •์˜๋œ view ๊ฐ์ฒด ์ค‘์—์„œ id๊ฐ€ submit_button์ธ ๊ฒƒ์„ ์ฐพ์•„ ๋ฐ˜ํ™˜ํ•จ
        val btn = findViewById<Button>(R.id.submit_button)

        //๋ฒ„ํŠผ์ด ํด๋ฆญ๋˜์—ˆ์„ ๋•Œ ๋ฐœ์ƒ๋˜๋Š” ํด๋ฆญ ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” View.OnClickListener ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ตฌํ˜„
        btn.setOnClickListener{
            Toast.makeText(this,"submitted successfully", Toast.LENGTH_SHORT).show()
        }
    }
}

    // findViewById( )

    : Activity ํด๋ž˜์Šค์— ์ •์˜๋œ ๋ฉ”์†Œ๋“œ๋กœ, Activity ํ•˜์œ„ ํด๋ž˜์Šค(ex. AppCompatActivity)์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

    - ํ•ด๋‹น ์•กํ‹ฐ๋น„ํ‹ฐ์™€ ์—ฐ๊ฒฐ๋œ XML layout ๋ฆฌ์†Œ์Šค ์š”์†Œ (์œ„์ ฏ) ์ค‘์—์„œ id์†์„ฑ์„ ๋ฐ”ํƒ•์œผ๋กœ ํ•ด๋‹น java ๊ฐ์ฒด๋ฅผ ๊ฐ€์ ธ์˜ด
        - onCreate() ๋ฉ”์†Œ๋“œ ๋‚ด์˜ setContentView() ๋ฅผ ํ†ตํ•ด์„œ ์—ฐ๊ฒฐ๋œ XML ๋ฆฌ์†Œ์Šค ์š”์†Œ ์ค‘์—์„œ๋งŒ ๊ฒ€์ƒ‰์ด ๊ฐ€๋Šฅํ•จ
            -> ๋‹ค๋ฅธ ์•กํ‹ฐ๋น„ํ‹ฐ์™€ ์—ฐ๊ฒฐ๋œ XML layout ๋ฆฌ์†Œ์Šค์— ์ •์˜๋œ ์œ„์ ฏ์„ findViewById( ) ๋ฉ”์†Œ๋“œ๋กœ ๊ฐ€์ ธ์˜ฌ ์ˆ˜๋Š” ์—†์Œ

 

 

6. ImageView

    : ์•ฑ ํ™”๋ฉด์— ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œํ•˜๋Š” ์šฉ๋„

    [1] layout ๋ฆฌ์†Œ์Šค XML ํŒŒ์ผ์— ImageView๋ฅผ ์ถ”๊ฐ€

        - "src" ์†์„ฑ์— ์ด๋ฏธ์ง€(drawable)์˜ ๋ฆฌ์†Œ์Šค ID๋ฅผ ์ง€์ •
        - android : src-Image View์— ํ‘œ์‹œ ๋  Drawable ์ง€์ •
            (@drawable/xxx์˜ ํ˜•์‹์œผ๋กœ Drawable ๋ฆฌ์†Œ์Šค ์ง€์ • ๊ฐ€๋Šฅ, ์ปฌ๋Ÿฌ๊ฐ’ ์‚ฌ์šฉ ๊ฐ€๋Šฅ)

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageView1"
    android:scr="@drawable/android_icon"/>

    [2] ํ™”๋ฉด์— ํ‘œ์‹œํ•  ์ด๋ฏธ์ง€๋ฅผ Drawable ๋ฆฌ์†Œ์Šค์— ์ถ”๊ฐ€

        - ์ด๋ฏธ์ง€ ํŒŒ์ผ์˜ ํ˜•์‹์€ .png๋ฅผ ๋งŽ์ด ์‚ฌ์šฉ (ํˆฌ๋ช…๋„)
        - ์ด๋ฏธ์ง€ ํŒŒ์ผ์„ /res/drawable์— ์ถ”๊ฐ€
        - ํ•ด์ƒ๋„์— ๋”ฐ๋ฅธ ๋‹ค๋ฅธ ํฌ๊ธฐ์˜ ์ด๋ฏธ์ง€๋Š” ๋ณ„๋„์˜ ํด๋”๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ๋ณต์‚ฌ (ex. drawable-xhdpi ๋“ฑ...)
        - ํ•œ๊ธ€ ํฌํ•จ ๋ถˆ๊ฐ€, ๋Œ€๋ฌธ์ž ํฌํ•จ ๋ถˆ๊ฐ€, ์ˆซ์ž๋กœ ์‹œ์ž‘ ๋ถˆ๊ฐ€ // _๋กœ ์‹œ์ž‘ ๊ฐ€๋Šฅ

    [3-1] ํ™”๋ฉด์— ํ‘œ์‹œํ•  ์ด๋ฏธ์ง€(Drawable)๋ฆฌ์†Œ์Šค id๋ฅผ ImageView์˜ "src" ์†์„ฑ์— ์ง€์ •

 

    [3-2] Kotlin ์†Œ์Šค์—์„œ ImageView์˜ ์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ

        : ImageView์˜ id๋ฅผ ์ด์šฉํ•ด ์ฐธ์กฐ๋ฅผ ํš๋“ํ•œ ํ›„, setImageResource( ) ํ•จ์ˆ˜ ํ˜ธ์ถœ

class MainActivity : AppCompatActivity(){
    override fun onCreate(savedInstanceState: Bundle?){
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        
        var imageView: ImageView = findViewById(R.id.imageView1)
        imageView.setImageResource(R.drawable.google_logo)
    }
}

 

    [4] ImageView์˜ ์˜์—ญ์— ๋งž๊ฒŒ ์ด๋ฏธ์ง€ ํ™•๋Œ€ ๋˜๋Š” ์ถ•์†Œ

        : scaleType ์†์„ฑ > android:scaleType

    (1) android:scaleType = "Center"

        : ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ, ๋น„์œจ์„ ์œ ์ง€ํ•˜๋ฉฐ ์ด๋ฏธ์ง€์˜ ์ค‘์•™์„ ImageView์˜ ์ค‘์‹ฌ์— ๋งž์ถค
         (ImageView๋ณด๋‹ค ์ด๋ฏธ์ง€๊ฐ€ ํด ๊ฒฝ์šฐ ์ด๋ฏธ์ง€๊ฐ€ ์ž˜๋ฆผ)

    (2) android:scaleType = "centerCrop"

        : ์ด๋ฏธ์ง€์˜ ๋น„์œจ์„ ์œ ์ง€ํ•˜๋ฉฐ ๊ฐ€๋กœ, ์„ธ๋กœ ์ค‘ ์งง์€ ์ชฝ์„ ImageView์— ๊ฝ‰ ์ฐจ๊ฒŒ ์ถœ๋ ฅ
         (ImageView๋ฅผ ๋ฒ—์–ด๋‚˜๋Š” ๋ถ€๋ถ„์€ ์ถœ๋ ฅ๋˜์ง€ ์•Š์Œ)

    (3) android:scaleType = "centerInside"

        : ์ด๋ฏธ์ง€์˜ ๊ฐ€๋กœ, ์„ธ๋กœ ์ค‘ ๊ธด ์ชฝ์„ ImageView์˜ ๋ ˆ์ด์•„์›ƒ์— ๋งž์ถฐ ์ถœ๋ ฅ
         (์ด๋ฏธ์ง€์˜ ๋น„์œจ ์œ ์ง€๋จ, ๋‚จ๋Š” ๊ณต๊ฐ„์€ background์˜ ์ƒ‰์œผ๋กœ ์ฑ„์›Œ์ง)
        - fitCenter๊ณผ ๋‹ฌ๋ฆฌ, ์ด๋ฏธ์ง€๊ฐ€ ImageView๋ณด๋‹ค ์ž‘์„ ๊ฒฝ์šฐ ํฌ๊ธฐ ์œ ์ง€๋จ

    (4) android:scaleType = "fitCenter"

        : centerInside์™€ ์œ ์‚ฌ
         (๋‹จ, ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ๊ฐ€ ImageView๋ณด๋‹ค ์ž‘๋‹ค๋ฉด ImageView์˜ ํฌ๊ธฐ์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง)

    (5) android:scaleType = "fitStart"

        : ImageView ์•ˆ์—์„œ ๊ฐ€๋กœ, ์„ธ๋กœ ๋น„์œจ์„ ์œ ์ง€ํ•˜๋ฉฐ fitํ•˜๊ฒŒ ์ถœ๋ ฅ๋จ
         (๋‹จ, fitCenter๊ณผ ๋‹ค๋ฅด๊ฒŒ ์™ผ์ชฝ ์ƒ๋‹จ์„ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌ๋จ)

    (6) android:scaleType = "fitEnd"

        : fitStart์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๊ฐ€๋กœ, ์„ธ๋กœ ๋น„์œจ์„ ์œ ์ง€ํ•˜๋ฉฐ fitํ•˜๊ฒŒ ์ถœ๋ ฅ๋จ
         (์šฐ์ธก ํ•˜๋‹จ์„ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌ)

    (7) android:scaleType = "fitXY"

        : ๊ฐ€๋กœ, ์„ธ๋กœ ๋น„์œจ์— ์ƒ๊ด€์—†์ด ImageView์— ๊ฝ‰ ์ฐจ๊ฒŒ ๊ทธ๋ ค์ง
         (์ด๋ฏธ์ง€๊ฐ€ ์ฐŒ๊ทธ๋Ÿฌ์ง„ ์ƒํƒœ๋กœ ๋ณด์ž„)

    (8) android:scaleType = "matrix"

        : ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ, ๋น„์œจ์„ ์œ ์ง€ํ•˜๋ฉฐ ImageView์˜ ์ขŒ์ธก ์ƒ๋‹จ์„ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌ
         (์ด๋ฏธ์ง€๊ฐ€ ํฌ๋‹ค๋ฉด ImageView ์™ธ์˜ ๋ถ€๋ถ„์€ ์ถœ๋ ฅ๋˜์ง€ ์•Š์Œ)