반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- SwiftUI
- Observable
- NavigationLink
- Swift
- swipe
- dictionary
- 웹뷰
- Realtime Database
- Firebase
- Alamofire
- WebView
- UITabBarController
- autolayout
- LazyHStack
- UIScrollView
- gcd
- Java
- remote config
- subscript
- 라이트모드
- string
- github
- 다크모드
- UIButton
- SwiftLint
- Android
- ios
- 문자열
- RxSwift
- Apple
Archives
- Today
- Total
점진적 과부하 개발 블로그
Android Splash Screen 화면 구현 본문
반응형
Android Splash Screen 화면 구현
SplashActivy 만들기
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Handler hd = new Handler();
hd.postDelayed(new SplashHandler(), 3000);
}
private class SplashHandler implements Runnable {
@Override
public void run() {
startActivity(new Intent(getApplication(), MainActivity.class));
SplashActivity.this.finish();
}
}
}
- 소스 추가
- 3초 머물다 MainActity로 넘어감
activity_splash.xml
- Splash Screen 디자인 , 간단하게 텍스트 추가
<?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:gravity="center"
tools:context=".SplashActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Splash Screen"
android:textStyle="bold"
android:textSize="50sp"
android:textColor="@color/black"/>
</LinearLayout>
AndroidManifest.xml 수정
- SplashActivity가 먼저 불러올수 있게 Manifest 파일 수정
<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.SplashTest">
<activity android:name=".MainActivity"></activity>
<activity android:name=".SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
실행화면
- 성공 !
반응형
'Android > Java' 카테고리의 다른 글
Android 13주차 Graphic (0) | 2022.05.30 |
---|---|
Android Toast & Snackbar (0) | 2022.04.19 |