一、Android选择启动页
<activity
android:name=".activity.HelloActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
二、Android设置APK安装位置
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="string"
android:sharedUserId="string"
android:sharedUserLabel="string resource"
android:versionCode="integer"
android:versionName="string"
android:installLocation=["auto" | "internalOnly" | "preferExternal"] >
</manifest>
android:installLocation可以设置为"auto"、"internalOnly"、"preferExternal"三个值中的任何一个.
auto:程序可能被安装在外部存储介质上(例如:SD Card),但是默认会被安装到手机内存中.当手机内存为空时,程序将被安装到外部存储介质上.当程序安装到手机上后,用户可以决定把程序放在外部储介质还是内存中.
internalOnly:默认值.当设置为该值时,程序只能被安装在内存中,如果内存为空,则程序将不能成功安装.
preferExternal:将程序安装在外部存储介质上,但是系统不保证程序一定会被安装到外部存储介质上.当外部存储介质不可以或空时,程序将被安装到内存中.程序使用了forward-locking机制时也将被安装到内存中,因为外部存储不支持此机制.程序安装后,用户可以自由切换程序应该在外部还是内部存储介质上.
三、category.LAUNCHER与installLocation的矛盾
1、设置Android的启动自己的Launcher,如果在设置android:installLocation="preferExternal",则启动自己的Launcher失效
2、设置Android的启动自己的Launcher,最好设置android:installLocation="internalOnly",则启动自己的Launcher有效
本文介绍了如何在Android应用中设置启动页及APK安装位置。包括配置启动活动、指定安装位置选项及其对启动器的影响等内容。
1894

被折叠的 条评论
为什么被折叠?



