Splash.class 작성
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
public class Splash extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler hd = new Handler();
hd.postDelayed(new Runnable() {
@Override
public void run() {
finish(); // 3 초후 이미지를 닫아버림
}
}, 3000);
}
}
MainActivity.class
setContentView(R.layout.main);
// 위 소스 아래부분에 splash.class 호출
startActivity(new Intent(this,Splash.class));
3초가 로딩 후 메인화면 뿌려짐
AndroidManifest.xml
기존 activity 태그 위에 아래 태그 삽입
res > layout 폴더 아래
splash.xml 추가
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_launcher">
끝~~
댓글 없음:
댓글 쓰기