'안드로이드 Intro'에 해당되는 글 1건

  1. 2012.02.16 안드로이드 Intro 만들기 예제 따라하기
JAVA/Android2012.02.16 10:10
- App을 시작하기전 Intro 화면을 띄우는 예제이다.
- Intro를 통해 App을 간단하고 명확하게 소개 및 설명 할 수 있다.

-Java 소스
public class Intro extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.intro);

new Thread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
try {
Thread.sleep(2000);
} catch (Throwable ex) {
ex.printStackTrace();
}
Intent i = new Intent(Intro.this, IntroexamActivity.class);
startActivity(i);
finish();
}
}).start();
}
}
-------------------------------------------------------------------------------------------------------
public class IntroexamActivity extends Activity {  //인트로 후 메인
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
-------------------------------------------------------------------------------------------------------- - xml 소스
<!--intro.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" >

    <ImageView
        android:id="@+id/intro"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="fitXY"
        android:src="@drawable/ic_launcher" >
    </ImageView>

</LinearLayout>
-------------------------------------------------------------------------------------------------------
<!--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>
--------------------------------------------------------------------------------------------------------- AndroidManifest.xml
 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="Introexam.org"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".Intro"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".IntroexamActivity"
            android:label="@string/app_name" >
        </activity>
    </application>

</manifest>
------------------------------------------------------------------------------------------------------- - 실행 화면
 

   

신고
Posted by Namseungil