일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
- 전자정부프레임워크
- SQLD
- kaldi korea
- java 배열
- 코딩테스트
- 파이썬
- kaldi zeroth
- JavaScript
- kaldi 한국
- 한국어 음성인식
- kaldi 한국어
- 리눅스
- 경영학 공부
- modal
- jQuery
- Java
- 오픈소스 음성인식
- 네이버음성합성
- 플랫폼공작소
- 이사작전
- rest api란
- MySQL
- java 코딩테스트
- kaldi zeroth korea
- Cordova
- rest란
- Firebase
- 음성합성
- kaldi
- css
- Today
- 32
- Total
- 302,264
팀드모네 IT Blog
3분 내로 Kotlin splash 쉽게 구현하기 본문
안녕하세요. 팀드모네입니다.
코틀린에서 스플래시 화면 띄우는거 별로 안 어려워요.
많은 사람들이 착각하는 것 같아 직접 포스팅합니다.
실무는 안전한게 최고에요. 이러면 좋지 않을까? 라는 것을 권장할 수 없습니다.
명쾌하게 Kolin splash 화면을 구현하는 방법을 공유드립니다. 그냥 순서대로 하시면 됩니다.
1. res > layout 폴더에 activity_splash_screen.xml을 생성
</RelativeLayout>
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="All In One"
android:padding="10dp"
android:layout_gravity="center_horizontal"
android:textColor="@color/black"/>
</LinearLayout>
</RelativeLayout>
2. res > drawable 폴더에 splash.png 이미지를 넣어주세요.
splash.png가 뭐냐면 스플래시 화면에서 띄울 이미지입니당.
3. res > values > color.xml에 아래의 코드를 기술해주세요.
* color.xml의 디렉터리(파일 위치)는 당신의 개발 환경에 따라 조금씩 다를 수 있습니다.
<color name="windowBackground">#FFFFFFFF</color>
4. SplashScreenActivity 코틀린 클래스 하나 생성하셔서 아래의 코드를 기입하세요
class SplashScreenActivity : AppCompatActivity() {
// After 3000 mileSeconds / 3 seconds your next activity will display.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
loadSplashScreen()
}
private fun loadSplashScreen(){
Handler().postDelayed({
// You can declare your desire activity here to open after finishing splash screen. Like MainActivity
val intent = Intent(this,MainActivity::class.java)
startActivity(intent)
finish()
}, 3000)
}
}
5. AndroidManifest.xml에 SplashScreenActivity를 기술해주세요.
* 아래의 코드를 참고하시면 감이 오실 것입니다. 혹시 아래 코드를 그대로 기입하시는 분은 없겠죠..?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.cordova.seoulfilter" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Kotlin4javascriptinterface" >
<activity android:name="io.cordova.seoulfilter.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="io.cordova.seoulfilter.MainActivity" ></activity>
</application>
</manifest>
끝. 작업하시다가 모르겠다면, 아래의 URL을 참고해주세요.
혹은 댓글을 남겨주셔도 친절하게 답변드리겠습니다.
URL : medium.com/@ansarali.edugaon/how-to-create-splash-screen-in-android-kotlin-4525a100d257
끝. 좋은 하루되세욥~
'mobile > Android' 카테고리의 다른 글
3분 내로 Kotlin splash 쉽게 구현하기 (0) | 2021.03.30 |
---|---|
[solved] Must be called on the main UI thread (0) | 2021.03.20 |
안드로이드 프래그먼트 웹뷰 뒤로가기 (0) | 2020.07.03 |
웹뷰, 웹앱에서 confirm, tel 등이 되도록 만드는 방법 (0) | 2020.07.03 |
You need to use a Theme.AppCompat theme (or descendant) with this activity. (0) | 2020.03.26 |
Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy 해결방법 (0) | 2020.03.21 |
- Tag
- kotlin splash, 코틀린 스플래시 화면