๋ฐ๊ฒฝ์†ก์˜ E.B

Android <5> Layouts & Tip(ํŒ) ๊ณ„์‚ฐ๊ธฐ๐Ÿ”ข ๋ณธ๋ฌธ

GDSC/Android

Android <5> Layouts & Tip(ํŒ) ๊ณ„์‚ฐ๊ธฐ๐Ÿ”ข

m_gyxxmi 2023. 11. 18. 20:02

๐Ÿ‘ฝ๋ฏธ๋ฆฌ ์•Œ๊ณ  ๋“ค์–ด๊ฐ€๊ธฐ

 

Android ์•ฑ์˜ UI๋Š” ๊ตฌ์„ฑ์š”์†Œ(์œ„์ ฏ)์˜ ํฌํ•จ UI ๊ณ„์ธต ๊ตฌ์กฐ์™€ ์ด๋Ÿฌํ•œ ๊ตฌ์„ฑ์š”์†Œ์˜ ํ™”๋ฉด ๋ ˆ์ด์•„์›ƒ์œผ๋กœ ๋นŒ๋“œ๋จ.

 

*UI ์š”์†Œ์˜ ๋ทฐ ๊ณ„์ธต ๊ตฌ์กฐ

ํ•˜์œ„ ๋ทฐ์™€ ์ƒ์œ„ ๋ทฐ

 

 

 

๊ฐ UI ์š”์†Œ๋Š” XML ํŒŒ์ผ์˜ XML ์š”์†Œ๋กœ ํ‘œํ˜„ + ๊ฐ ์š”์†Œ๋Š” ํƒœ๊ทธ๋กœ ์‹œ์ž‘ํ•ด์„œ ํƒœ๊ทธ๋กœ ๋๋‚จ.

 

*์œ„์˜ ํŒŒ๋ž€์ƒ‰ ๋ถ€๋ถ„์€ ์•„๋ž˜์™€ ๊ฐ™์ด ์ ์„ ์ˆ˜๋„ ์žˆ๋‹ค! (ํƒœ๊ทธ์˜ ์ฐจ์ด)

<TextView
	android:text="Hello World!" />

 

 

 

์˜ˆ์ œ: TextView ์•„๋ž˜ Button์„ ํ•˜์œ„ ์š”์†Œ๋กœ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒฝ์šฐ

<androidx.constraintlayout.widget.ConstraintLayout>
    <TextView
        android:text="Hello World!" />
    <Button
        android:text="Calculate" />
</androidx.constraintlayout.widget.ConstraintLayout>

ConstraintLayout ํƒœ๊ทธ์˜ ๊ฒฝ์šฐ ์œ„์™€ ๊ฐ™์ด ๊ธธ๊ฒŒ ํ‘œ์‹œ๋˜๋Š” ์ด์œ 

: ConstraintLayout์ด ํ•ต์‹ฌ Android ํ”Œ๋žซํผ ์™ธ์—๋„ ์ถ”๊ฐ€ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ์ฝ”๋“œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ํฌํ•จ๋œ Android Jetpack์˜ ์ผ๋ถ€์ด๊ธฐ ๋•Œ๋ฌธ

 


 

์˜ค๋Š˜์˜ ๊ณผ์ œ : ๐Ÿ”ขํŒ ๊ณ„์‚ฐ๊ธฐ ์•ฑ ๋งŒ๋“ค๊ธฐ ๐Ÿ”ข

 

์ตœ์ข… ๊ฒฐ๊ณผ๋ฌผ

 

 

๐Ÿ”ข ์„œ๋น„์Šค ๋น„์šฉ ํ…์ŠคํŠธ ์ž…๋ ฅ๋ž€ ์ถ”๊ฐ€ํ•˜๊ธฐ

: EditText ์š”์†Œ = ์‚ฌ์šฉ์ž๊ฐ€ ์•ฑ์—์„œ ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์š”์†Œ

<!-- ์‚ฌ์šฉ์ž๊ฐ€ ์•ฑ์—์„œ ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅ/์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์š”์†Œ+์ œ์•ฝ์กฐ๊ฑด-->
    
    <EditText
        android:id="@+id/plain_text_input"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:inputType="text"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />

 

๐Ÿค”์ œ์•ฝ์กฐ๊ฑด์˜ ์ด๋ฆ„

: layout_constraint<Source>_to<Target>Of ํ˜•์‹

Source - ํ˜„์žฌ ๋ทฐ, Target - ํ˜„์žฌ ๋ทฐ๊ฐ€ ์ œํ•œ๋˜๋Š” ํƒ€๊ฒŸ ๋ทฐ(์ƒ์œ„ ์ปจํ…Œ์ด๋„ˆ ๋˜๋Š” ๋‹ค๋ฅธ ๋ทฐ)์˜ ๊ฐ€์žฅ์ž๋ฆฌ

 

 

๐Ÿค”๋ฆฌ์†Œ์Šค ID

: XML ํŒŒ์ผ์˜ ์ƒˆ๋กœ์šด ๋ทฐ ID๋Š” @+id ์ ‘๋‘์‚ฌ๋กœ ์ •์˜ํ•ด์•ผ ํ•˜๊ณ  ์ด ์ ‘๋‘์‚ฌ๋Š” Android ์ŠคํŠœ๋””์˜ค์— ์ด ID๋ฅผ ์ƒˆ ๋ฆฌ์†Œ์Šค ID๋กœ ์ถ”๊ฐ€ํ•˜๋ผ๊ณ  ์ง€์‹œ.

-> ์•ฑ์ฝ”๋“œ์—์„œ ๋ฆฌ์†Œ์ŠคID๋ฅผ ์ฐธ์กฐํ•  ๋•Œ๋Š” R.<type>.<name>  ์‚ฌ์šฉ (ex. R.id.button)

 

 

*์†์„ฑ ์ˆ˜์ •ํ•˜๊ธฐ

<EditText
        android:id="@+id/cost_of_service"
        android:layout_height="wrap_content" 
        android:layout_width="160dp" <- ๊ณ ์ •๋„ˆ๋น„๋กœ ๋ณ€๊ฒฝ
        android:inputType="numberDecimal" <- ์ˆซ์ž๋งŒ ์ž…๋ ฅ๋ฐ›๊ธฐ
        android:hint="Cost of Service" <--์‚ฌ์šฉ์ž์—๊ฒŒ ์ž…๋ ฅ๋ž€์— ๋Œ€ํ•œ ํžŒํŠธ ์ฃผ๊ธฐ
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />

 

 

 


โš ๏ธ๊ฐ‘๋ถ„ ์—๋Ÿฌ ๋ฐœ์ƒ๊ณผ ํ•ด๊ฒฐ ..

๋”๋ณด๊ธฐ

โš ๏ธ An issue was found when checking AAR metadata:

1. Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34.

Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

-> ์‹คํ–‰ํ–ˆ๋”๋‹ˆ ์š”๋Ÿฐ ์—๋Ÿฌ ๋ฐœ์ƒ !

: ์ฐพ์•„๋ณด๋‹ˆ androidx.activity:activity ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ์ตœ์‹  ๋ฒ„์ „์ด ์•ˆ๋“œ๋กœ์ด๋“œ API ๋ ˆ๋ฒจ 34 ์ด์ƒ์„ ํ•„์š”๋กœ ํ•˜๋Š”๋ฐ, ํ˜„์žฌ ํ”„๋กœ์ ํŠธ๊ฐ€ ์‚ฌ์šฉ ์ค‘์ธ ์•ˆ๋“œ๋กœ์ด๋“œ API ๋ ˆ๋ฒจ์ด 33์ด์–ด์„œ ๋ฐœ์ƒํ•œ ๋ฌธ์ œ๋ผ๊ณ  ํ•จ

 

app > Gradle Scripts > build.gradle.kt(:app) ํŒŒ์ผ์—์„œ

compileSdk = 33

์œผ๋กœ ๋ผ์žˆ๋Š” ๋ถ€๋ถ„์„ 34๋กœ ๋ณ€๊ฒฝ ํ›„, sync now ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ์žฌ์‹คํ–‰ํ•˜๋ฉด ํ•ด๊ฒฐ๋จ!

 


 


 

 

๐Ÿ”ข ์„œ๋น„์Šค์— ๋Œ€ํ•œ ์งˆ๋ฌธ ์ถ”๊ฐ€ํ•˜๊ธฐ

<TextView
    android:id="@+id/service_question"
    android:layout_width="wrap_content" <- Textview๊ฐ€ ๋‚ด๋ถ€์˜ ํ…์ŠคํŠธ ์ฝ˜ํ…์ธ ๋งŒํผ๋งŒ ํฌ๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ!
    android:layout_height="wrap_content"
    android:text="์„œ๋น„์Šค๋Š” ์–ด๋– ์…จ๋‚˜์š”?" 
    
    <!-- ์ œ์•ฝ์กฐ๊ฑด ์ถ”๊ฐ€ํ•˜๊ธฐ -->
    app:layout_constraintStart_toStartOf="parent" <- ์‹œ์ž‘ ๊ฐ€์žฅ์ž๋ฆฌ๋ฅผ ์ƒ์œ„ ์š”์†Œ์˜ ์‹œ์ž‘ ๊ฐ€์žฅ์ž๋ฆฌ๋กœ
    app:layout_constraintTop_toBottomOf="@id/cost_of_service"/>
    <- ์ƒ๋‹จ ๊ฐ€์žฅ์ž๋ฆฌ๋ฅผ ์„œ๋น„์Šค๋น„์šฉview์˜ ๊ฐ€์žฅ์ž๋ฆฌ๋กœ ์ œํ•œ

 

 

 

๐Ÿ”ข ํŒ ์˜ต์…˜ ์ถ”๊ฐ€ํ•˜๊ธฐ - ์ ์ ˆํ•œ ์š”์†Œ ์‚ฌ์šฉํ•˜๊ธฐ

: ์˜ต์…˜ 3๊ฐ€์ง€ ์ถ”๊ฐ€ํ•˜๊ธฐ - ํ›Œ๋ฃกํ•จ(20%), ์ข‹์Œ(18%), ๊ดœ์ฐฎ์Œ(15%)

 

--๊ตฌ์กฐ--

RadioGroup : ์ƒ์œ„ ๋ทฐ

| -- RadioButton : ํ•˜์œ„ ๋ทฐ

 

<RadioGroup
    android:id="@+id/tip_options"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/service_question"> <-์„œ๋น„์Šค ์งˆ๋ฌธ ์•„๋ž˜ ๋ฐฐ์น˜


</RadioGroup>

 

	<RadioButton
            android:id="@+id/option_twenty_percent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="์ตœ๊ณ ! (20%)" />

        <RadioButton
            android:id="@+id/option_eighteen_percent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="์ข‹์•„์š” (18%)" />

        <RadioButton
            android:id="@+id/option_fifteen_percent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="๊ดœ์ฐฎ์•˜์–ด์š” (15%)" />

 

 

๐Ÿค”๊ธฐ๋ณธ ์„ ํƒ ์ถ”๊ฐ€ํ•˜๊ธฐ

* RadioGroup์—๋Š” ์ฒ˜์Œ์— ์„ ํƒํ•ด์•ผ ํ•˜๋Š” ๋ฒ„ํŠผ์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ์ด ์žˆ์Œ

= checkButton : ์„ ํƒํ•˜๊ธธ ๋ฐ”๋ผ๋Š” ๋ผ๋””์˜ค ๋ฒ„ํŠผ์˜ ๋ฆฌ์†Œ์Šค ID๋กœ ๊ฐ’์„ ์„ค์ •

   android:id="@+id/tip_options"
   android:checkedButton="@id/option_twenty_percent"

 

๊ฒฐ๊ณผ๋ฌผ! ์Œ ๊ท€์—ฝ๊ตฐ


 

๐Ÿ”ข ํŒ์„ ๋ฐ˜์˜ฌ๋ฆผํ•˜๊ธฐ ์œ„ํ•œ Switch ์œ„์ ฏ ์ถ”๊ฐ€ํ•˜๊ธฐ

<Switch
    android:id="@+id/round_up_switch"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:checked="true" <-- ๊ธฐ๋ณธ๊ฐ’์„ true๋กœ ์„ค์ •
    android:text="ํŒ์„ ๋ฐ˜์˜ฌ๋ฆผํ• ๊นŒ์š”?"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="@id/tip_options"
    app:layout_constraintTop_toBottomOf="@id/tip_options" />

 

 

๐Ÿ”ข ๊ณ„์‚ฐ ๋ฒ„ํŠผ ์ถ”๊ฐ€ํ•˜๊ธฐ

<Button
        android:id="@+id/calculate_button"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="๊ณ„์‚ฐํ•˜๊ธฐ"
        app:layout_constraintTop_toBottomOf="@id/round_up_switch"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

 

๋”๋ณด๊ธฐ

๐Ÿค” View์˜ ๋„ˆ๋น„๋ฅผ ํฌํ•จ๋˜๋Š” ConstraintLayout์˜ ๋„ˆ๋น„์™€ ๊ฐ™๊ฒŒ ํ•˜๋ ค๋ฉด ์‹œ์ž‘๊ณผ ๋์„ ์ƒ์œ„ ์š”์†Œ์˜ ์‹œ์ž‘๊ณผ ๋์œผ๋กœ ์ œํ•œํ•˜๊ณ  ๋„ˆ๋น„๋ฅผ 0dp๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค!

 

๐Ÿ”ขํŒ ๊ฒฐ๊ณผ ์ถ”๊ฐ€ํ•˜๊ธฐ

<TextView
        android:id="@+id/tip_result"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/calculate_button"
        android:text="Tip Amount" />

 

 


ํŒ ๊ณ„์‚ฐํ•˜๋Š” ๊ธฐ๋Šฅ ๊ตฌํ˜„ํ•˜๊ธฐ

 

๐Ÿง™‍โ™€๏ธ๋ทฐ ๊ฒฐํ•ฉ ์‚ฌ์šฉ ์„ค์ •

: ํŒ์„ ๊ณ„์‚ฐํ•˜๋ ค๋ฉด ์ฝ”๋“œ๊ฐ€ ๋ชจ๋“  UI ์š”์†Œ์— ์—‘์„ธ์Šคํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ์„ ์ฝ์–ด์•ผ ํ•จ

-> ๋ทฐ์— ๋Œ€ํ•œ ์ฐธ์กฐ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ์ž‘์—… ์‹คํ–‰  (findViewById()๋ณด๋‹ค ๊ฐ„๋‹จํ•œ ๊ธฐ๋Šฅ)

 

build.gradle ํŒŒ์ผ์˜ android ์„น์…˜์— ๋‚ด์šฉ ์ถ”๊ฐ€

buildFeatures {
    viewBinding = true
}

 

 

๐Ÿง™‍โ™€๏ธ๊ฒฐํ•ฉ ๊ฐ์ฒด ์ดˆ๊ธฐํ™” 

: ์•ฑ์˜ ๊ฐ View๋งˆ๋‹ค findViewById()๋ฅผ ํ˜ธ์ถœํ•˜๋Š”๋Œ€์‹ , View Binding์œผ๋กœ ๊ฒฐํ•ฉ ๊ฐ์ฒด๋ฅผ ํ•œ ๋ฒˆ ๋งŒ๋“ค๊ณ  ์ดˆ๊ธฐํ™” !

 

 

MainActivity.kt ์ฝ”๋“œ ์ˆ˜์ •ํ•˜๊ธฐ -> *ActivityMainBinding import๋ฌธ๋„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•จ!

package com.myfirstandroidapp.realtiptime

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.myfirstandroidapp.realtiptime.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
    lateinit var binding: ActivityMainBinding // ๊ฒฐํ•ฉ ๊ฐ์ฒด์˜ ์ตœ์ƒ์œ„ ๋ณ€์ˆ˜ ์„ ์–ธ

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater) // activity_main.xml ๋ ˆ์ด์•„์›ƒ์—์„œ
        Views์— ์—‘์„ธ์Šคํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  binding ๊ฐ์ฒด ์ดˆ๊ธฐํ™”
        setContentView(binding.root) // ํ™œ๋™์˜ ์ฝ˜ํ…์ธ  ๋ทฐ ์ƒ์„ฑ. ์•ฑ์˜ ๋ทฐ ๊ณ„์ธต ๊ตฌ์กฐ ๋ฃจํŠธ๋กœ ์ง€์ •

    }
}

 

 

 

๐Ÿค”์ง€๋‚œ ๋ฒˆ์— ์ฃผ์‚ฌ์œ„ ๊ตด๋ฆฌ๋Š” ์•ฑ์„ ๋งŒ๋“ค ๋•Œ๋Š” View์— ๋Œ€ํ•œ ์ฐธ์กฐ๊ฐ€ ํ•„์š”ํ•  ๋•Œ findViewById()๋ฅผ ๋งค๋ฒˆ ํ˜ธ์ถœํ•ด์„œ ์‚ฌ์šฉํ–ˆ๋Š”๋ฐ,

์ด์   ๊ทธ๋Ÿด ํ•„์š” ์—†์ด ์ง์ ‘ view ์ฐธ์กฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋œ๋‹ค๋Š” ์–˜๊ธฐ ๊ฐ™๋‹ค !!!!!!!!!!!!!

*why? 

: binding ๊ฐ์ฒด๋Š” ID๊ฐ€ ์žˆ๋Š” ์•ฑ์˜ ๋ชจ๋“  View๋ฅผ ์œ„ํ•œ ์ฐธ์กฐ๋ฅผ ์ž๋™์œผ๋กœ ์ •์˜ํ•˜๊ธฐ ๋•Œ๋ฌธ์—! View๋ฅผ ์œ„ํ•œ ์ฐธ์กฐ๋ฅผ ์œ ์ง€ํ•  ๋ณ€์ˆ˜ ์ƒ์„ฑ์ด ๋ถˆํ•„์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ!


package com.myfirstandroidapp.realtiptime

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.myfirstandroidapp.realtiptime.databinding.ActivityMainBinding
import java.text.NumberFormat

class MainActivity : AppCompatActivity() {
    lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        binding.calculateButton.setOnClickListener{ calculateTip() }
    }


    fun calculateTip() {

        //์„œ๋น„์Šค ๋น„์šฉ์˜ ํ…์ŠคํŠธ๋ถ€๋ถ„์„ ๊ฐ€์ ธ์˜ค๊ณ ,์‹ญ์ง„์ˆ˜๋กœ ๋ณ€ํ™˜
        // toDouble()์€ String์—์„œ ํ˜ธ์ถœ๋˜์–ด์•ผ ํ•จ : text -> String -> Double

        val stringInTextField = binding.costOfService.text.toString()
        val cost = stringInTextField.toDouble()

        //ํŒ ๋น„์œจ ๊ฐ€์ ธ์˜ค๊ธฐ
        val selectedId = binding.tipOptions.checkedRadioButtonId
        val tipPercentage = when (selectedId) {
            R.id.option_twenty_percent -> 0.20
            R.id.option_eighteen_percent -> 0.18
            else -> 0.15
        } // when๋ฌธ์—๋Š” ๋ฌด์กฐ๊ฑด else๊ฐ€ ํ•„์š”ํ•จ!

        var tip = tipPercentage * cost
        // ์‚ฌ์šฉ์ž์˜ switch ์˜ต์…˜ ์„ ํƒ์— ๋”ฐ๋ผ ๊ฐ’์ด ๋ฐ˜์˜ฌ๋ฆผ ๊ฐ’์œผ๋กœ ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ์Œ
        //-> val์ด ์•„๋‹ˆ๋ผ var

        val roundUp = binding.roundUpSwitch.isChecked
        //switch๊ฐ€ ์‚ฌ์šฉ ์„ค์ • ์ƒํƒœ์ธ์ง€ ํ™•์ธ

        if (roundUp) { //roundUp์ด ์ฐธ์ธ ๊ฒฝ์šฐ
            tip = kotlin.math.ceil(tip) //tip๋ณ€์ˆ˜์— tip์˜ ์ƒํ•œ ํ• ๋‹น
        }

        //์ˆซ์ž ํ˜•์‹ ์ง€์ • ํด๋ž˜์Šค ์‚ฌ์šฉ
        val formattedTip = NumberFormat.getCurrencyInstance().format(tip)

    }
}

 

๐Ÿง™‍โ™€๏ธํŒ ํ‘œ์‹œ

 

*app>res>values>strings.xml ํŒŒ์ผ์— ์ถ”๊ฐ€

    <string name="app_name">Real Tip Time: %s</string>
</resources>

* %s๋Š” ํ˜•์‹์ด ์ง€์ •๋œ ํ†ตํ™”๊ฐ€ ์‚ฝ์ž…๋˜๋Š” ์œ„์น˜์ด๋‹ค!

 

 

 

*calculateTip() ์—์„œ  ๋ฐ˜ํ™˜๋˜๋Š” ๊ฐ’์„ ํŒ ๊ฒฐ๊ณผ TextView์˜ text ์†์„ฑ์— ํ• ๋‹นํ•˜๊ธฐ

binding.tipResult.text = getString(R.string.tip_amount, formattedTip)

 

 

 

*app > res > layout > activity_main.xml ํŒŒ์ผ์˜  android:text๋ฅผ tools:text -- ๋กœ ์ˆ˜์ •


 

โš ๏ธ์•„ ๋˜ ๋ฌด์Šจ ์ด์ƒํ•œ ์˜ค๋ฅ˜๋‚ฌ๋Š”๋ฐ ๋ณด๋‹ˆ๊นŒ? ์ด ํŒŒ์ผ์—์„œ string/app_name ๋ฆฌ์†Œ์Šค๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†๋Œ€์šฅ..

=>  AndroidManifest.xml ํŒŒ์ผ์—์„œ android:label ์—, ์•ž์— string.xml์—์„œ ๋ฐ”๊พผ ์ด๋ฆ„์ธ tip_amount๋ฅผ ์ œ๋Œ€๋กœ ์ ์–ด์ค˜์•ผ ํ•จ!


 

๊ฒฐ๊ณผ๋ฌผ!!!!!!!!!! - ์•„๋‹ˆ ์™œ ๊ฐ‘์ž๊ธฐ ํ™”๋ฉด ์บก์ณ๊ฐ€ ์•ˆ๋˜๋Š”์ง€ .. ใ…  ๋ชจ๋ฅด๊ฒ ์—‡์š”

์•„๋ฌดํŠผ ์ž˜ ์ž‘๋™ํ•œ๋‹ค๋Š” >>..!

'GDSC > Android' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Android <4> Build your first Android app: [Dice Roller๐ŸŽฒ]  (1) 2023.11.17
Android <3> Classes and objects  (1) 2023.11.03
Android <2> More About Kotlin Functions  (1) 2023.10.14
Android <2> Kotlin Functions - (Almost) Everything has a value!  (0) 2023.10.07
Android <1> Kotlin Basic - Benefits of Kotlin  (0) 2023.09.18