Android Launcher开发

来源:互联网 发布:类似于faceu的软件 编辑:程序博客网 时间:2024/04/29 11:44

Launcher就是一个普通的应用,不需要在系统级实现。与普通的应用区别在于AndroidManifest.xml中声明:

<application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        >
        <activity
            android:name=".MyLauncherActivity"
            android:clearTaskOnLaunch="true"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:screenOrientation="nosensor"
            android:stateNotNeeded="true"
            android:windowSoftInputMode="stateUnspecified|adjustPan" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.MONKEY" />
            </intent-filter>
        </activity>
    </application>

上面的声明同时把状态栏隐藏了。在按Home键时,会弹出选择是启动系统自带的Launcher还是我们的Launcher,可以把我们的Launcher设为默认,重启机器后,启动的就是我们的Launcher,按返回键,Home键,显示的也是我们的Launcher.

0 0