我如何申报我的活动作为启动? [英] How do i declare my Activity as Launcher?
本文介绍了我如何申报我的活动作为启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想建立一个样定制锁屏的。
I am trying to build a kind of custom lockscreen.
为了达到我需要禁用HOME键。
In order to achieve that I need to disable the HOME button.
从<一个href=\"http://stackoverflow.com/questions/12436190/block-home-button-in-ice-cream-sandwich-and-jelly-bean\">this帖子我明白,我可以说出我的活动作为一个发射器实现这一目标。
From this post I understand that I can achieve that by declaring my Activity as a Launcher.
请我怎么做到这一点? (这是在清单中明显)
这是清单。
该活动是行为作为一个锁屏为的LockScreen
Please how do I do that? (it is in the Manifest obviously) This is the Manifest. The Activity that "acts" as a lockscreen is LockScreen
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appengine.paranoid_android.lost"
android:versionCode="2"
android:versionName="1.1" >
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".InfoSetup"
android:clearTaskOnLaunch="true"
android:label="@string/activity_name"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LockScreen"
android:clearTaskOnLaunch="true"
android:label="@string/activity_name"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.NoTitleBar" >
<service
android:name=".InfoService"
android:label="@string/service_name" />
<receiver android:name="com.appengine.paranoid_android.lost.BootCompleteReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
</activity>
</application>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<!-- <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" >
</uses-sdk>
推荐答案
移动意图过滤器到你的活动
Move the intent filter to your activity
<activity
android:name=".LockScreen"
android:clearTaskOnLaunch="true"
android:label="@string/activity_name"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
这篇关于我如何申报我的活动作为启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文