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 |
Tags
- Menu
- Java
- AWT
- 클래스
- Spring
- mybatis
- JSP
- 생성자
- oracle
- HTML
- Android
- 메소드
- 예외처리
- OGNL
- Graphic
- 국제화
- JavaScript
- 안드로이드
- 전화걸기
- Eclips
- 메서드
- 기본
- paint
- 이클립스
- 어노테이션
- 배열
- 오버로딩
- layout
- 에러페이지
- struts2
Archives
- Today
- Total
note
Android 메인로딩 페이지 만들기 본문
main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>splash.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/intro_black" android:gravity="center_vertical|center_horizontal"> <!-- <TextView android:layout_height="wrap_content" android:text="loading..." android:textSize="20sp" android:textStyle="bold" android:layout_width="wrap_content" /> --> </LinearLayout>
package kr.android.vichara; //시작되는 & 로딩페이지(로딩페이지를 호출함) import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.Window; public class MainActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState){ requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.splash);//로딩 이미지 있는곳 initialize(); } private void initialize(){ Handler handler = new Handler(){ @Override public void handleMessage(Message msg){ finish(); // 액티비티 종료 startActivity(new Intent(MainActivity.this, SplashActivity.class));//이동될 클래스 } }; handler.sendEmptyMessageDelayed(0, 3000); // ms, 3초후 종료시킴 } }SplashActivity
package kr.android.vichara; //이동되는곳 import android.app.Activity; import android.os.Bundle; import android.view.Window; public class SplashActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState){ requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.main);//로딩후 보여질페이지 initialize(); // 시간이 걸리는 작업 처리 } //스플래시 표시하는 것과 초기화를 동시에 진행시키기 위하여 쓰레드 처리 private void initialize(){ InitializationRunnable init = new InitializationRunnable(); new Thread(init).start(); } //초기화 class InitializationRunnable implements Runnable{ public void run(){ // 여기서부터 초기화 작업 처리 // do_something } } }
'Android > 기본' 카테고리의 다른 글
OX퀴즈 설명 (0) | 2012.03.04 |
---|---|
안드로이드 - 자료관리 (0) | 2012.02.17 |
Android surface(마우스에 이미지 따라다니기) (0) | 2012.02.01 |
Android Video View (동영상 재생) (0) | 2012.02.01 |
Android Audio사용 (음악 재생) (0) | 2012.02.01 |