Android 开发者 page对于 <application>
包含标志 hasCode
。它的描述是:
An application would not have any code of its own only if it's using
nothing but built-in component classes, such as an activity that uses
the AliasActivity class, a rare occurrence.
有人可以提供他们谈论的 AliasActivity 用例(罕见情况)的代码示例吗?
最佳答案
AliasActivity - 顾名思义 - 只是另一个 Activity 的别名。
您可以仅使用 XML 创建一个。有一个example available在 Android git 存储库中。
您的 list 可能如下所示:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.aliasactivity">
<application android:hasCode="false" android:label="@string/app_label">
<activity android:name="android.app.AliasActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.alias"
android:resource="@xml/alias" />
</activity>
</application>
</manifest>
在 res/xml/alias.xml 中定义 Intent :
<alias xmlns:android="http://schemas.android.com/apk/res/android">
<intent android:action="android.intent.action.VIEW"
android:data="http://www.google.com/">
</intent>
</alias>
关于Android - 应用程序 hasCode 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30968695/