스팀 앱 개발기 #111 - 시작 화면 추가

시작 화면 추가

No. 111
2023. 11. 07 (화) | Written by @dorian-mobileapp

시작하며...

다음 작업 리스트를 만들어 보았구요. 시간이 가장 짧게 드는 것을 택하기로 했습니다. 그것은 바로 시작 화면. 오늘은 이에 대해 글을 작성해 봅니다.


시작 화면

시작 화면은 아래와 같이 만들었습니다.


작업 내용

  • 클래스 추가: SplashActivity
  • AndroidManifest.xml 파일 수정
  • 레이아웃 리소스 추가: activity_splash.xml
  • 로고 파일 추가: img_pircoin.png (해적 로고)

SplashActivity 클래스

  • 로고를 보여주고,
  • 1.3초 후 다음 화면으로 이동
class SplashActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)

        lifecycleScope.launch {
            delay(1300)
            startActivity(Intent(this@SplashActivity, MainActivity::class.java))
        }
    }

}

AndroidManifest.xml 파일 수정

이전까지는 앱을 시작하는 액티비티가 MainActivity 클래스였지만, 오늘부로 SplashActivity로 바뀝니다. 그래서 전자에 있었던 intent-filter 요소를 후자로 옮겼습니다.

<activity
    android:name=".SplashActivity"
    android:exported="true"
    android:theme="@style/Theme.AppCompat.NoActionBar">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>


레이아웃 리소스 추가: activity_splash.xml

화면 한가운데에 로고를 보여주기 위해 ImageView 뷰를 사용합니다.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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="@color/white">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/img_pircoin" />

</RelativeLayout>

GitHub Commit

보다 자세한 코드는 아래 commit을 참고하세요.


마치며...

시작 화면은 실무에서도 여러번 만들어 봤기 때문에 오늘 작업은 상당히 빠르게 진행할 수 있었습니다. 할일 리스트를 만들고 제일 빠르게 구현할 수 있는 것을 우선으로 개발을 하고 있구요. 그래서 지금은 상대적으로 진도가 빨라진 거 같네요. 시간, 기회가 있을 때 가능한 빠르게 진행하고자 합니다.


지난 스팀 앱 개발기


Layout provided by Steemit Enhancer hommage by ayogom


Posted through the ECblog app (https://blog.etain.club)
Sort:  

안녕하세요.
SteemitKorea팀에서 제공하는 'steemit-enhancer'를 사용해 주셔서 감사합니다. 개선 사항이 있으면 언제나 저에게 연락을 주시면 되고, 관심이 있으신 분들은 https://cafe.naver.com/steemitkorea/425 에서 받아보실 수 있습니다. 사용시 @응원해 가 포함이 되며, 악용시에는 모든 서비스에서 제외될 수 있음을 알려드립니다.

[광고] STEEM 개발자 커뮤니티에 참여 하시면, 다양한 혜택을 받을 수 있습니다.

Thank you, friend!
I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
image.png
please click it!
image.png
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)

The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.


안녕하세요.
이 글은 SteemitKorea팀(@ayogom)님께서 저자이신 @dorian-mobileapp님을 응원하는 글입니다.
소정의 보팅을 해드렸습니다 ^^ 항상 좋은글 부탁드립니다
SteemitKorea팀에서는 보다 즐거운 steemit 생활을 위해 노력하고 있습니다.
이 글은 다음날 다시 한번 포스팅을 통해 소개 될 예정입니다. 감사합니다!

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.029
BTC 61153.73
ETH 3403.85
USDT 1.00
SBD 2.51