嘿,在 Launcher 代码中,我希望在主屏幕上显示一个应用程序,在 AndroidManifest.xml
中。我写了这些行:
<activity
android:name=".MyAppTabs"
android:theme="@android:style/Theme.NoTitleBar"
android:label="MyApp"
android:icon="@drawable/ic_launcher_app">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
添加这些行后,我的应用程序出现在主屏幕上,但它没有启动,但是使用菜单选项我可以启动我的应用程序...有什么帮助吗?
Adiing 更多细节.. 我在 xml 文件夹中有 default_workspace.xml 文件,我将我的应用程序添加到最喜欢的标签...
<favorite
launcher:packageName="com.android.launcher"
launcher:className="com.android.launcher.apps.MyAppTabs"
launcher:screen="3"
launcher:x="3"
launcher:y="0" />
如果需要任何其他信息..请告诉我。
最佳答案
这只能用于属于同一应用程序(在本例中为您的启动器)的应用程序。
您不应该启动要在 laucher 中运行的应用程序的 Activity
您应该获取要显示应用程序的父 View ,
将应用程序设计作为单个 View 或 View 组,将其视为 subview (这将是启动器父 View 的 subview )
将子应用 View 添加到启动器父 View 中。
关于android - 希望我的应用程序出现在启动器主屏幕上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14952672/