覆盖主页按钮的Andr​​oid [英] Override Home Button Android

查看:150
本文介绍了覆盖主页按钮的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编程的应用程序,必须保持一个平板电脑是每个人都可以访问的屏幕上。

I'm programming an app that must stay on the screen of a tablet which is accessible by everyone.

这意味着,只有谁知道通code的人可以访问平板电脑,同时通过-用户只能使用应用程序。不过,我卡上的主页按钮。有没有办法改变它?禁用,控制什么?

This means that only people who know the passcode can access the tablet, while passing-by users can only use the app. However, I'm stuck on the home button. Is there any way to change it? Disable, control, anything?

推荐答案

您可以用非常类似的活动code在AndroidManifest让你的应用程序作为主屏幕启动应用程序。这样,当PSS的home键你的应用程序将被打开用户$ P $。

You can make your application as a Home screen launcher app using very similar activity code in your AndroidManifest. This way when user press the home button your app will be opened.

    <activity
        android:name=".MainActivity"
        android:launchMode="singleTask"
        android:excludeFromRecents="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <!-- The following two intent-filters are the key to set homescreen -->
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />

        </intent-filter>
    </activity>

这篇关于覆盖主页按钮的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆