android - android :enabled mean for an application?是什么意思

标签 android android-manifest

我想弄清楚 android 文档中的这个描述指的是什么类型的组件。为什么 android 系统会尝试在我的应用程序中实例化组件?

android:启用

Whether or not the Android system can instantiate components of the application — "true" if it can, and "false" if not. If the value is "true", each component's enabled attribute determines whether that component is enabled or not. If the value is "false", it overrides the component-specific values; all components are disabled. The default value is "true".

最佳答案

Why would the android system try to instantiate components inside my application?

每次您的应用组件运行时,它都会由系统实例化,唯一的异常(exception)是通过 registerReceiver()BroadcastReceiver。因此,例如,每次对您的某个 Activity 调用 startActivity() 时,系统都会实例化您的组件。

现在,如果您的问题是“好吧,为什么他们要在应用程序级别使用 android:enabled?”,我无法解释。我一直怀疑他们有一个愿景,很久以前,一个 APK 可以容纳多个应用程序,尽管这从未得到支持。 FWIW,我已经提交了a documentation issue关于这一点。

关于android - android :enabled mean for an application?是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18090663/

相关文章:

Android - 在 HttpsURLConnection 中传递 OAuth1

android - 新的 Google Play 服务 8.3 SignInButton 打破了获取生日和名字/姓氏的能力

android - 启动时绕过主要 Activity

android - 为什么AndroidManifest.xml文件有多余的android :label attributes?

java - 尽管 Activity 存在于 AndroidManifest.xml 中,但该 Activity 却不在其中

java - 如何在Android应用程序中频繁更新文本

java - Android 相机的问题

android - saveInstanceState + restoreInstanceState VS configChanges

java - 尝试绘制自定义 View 时崩溃 - InflateException

Android 启动器图标不工作