Launcher2主菜单应用图标显示于整体布局中之详解
发布时间:2021-11-21 16:05:55 所属栏目:教程 来源:互联网
导读:1.Launcher.xml中: include layout=@layout/apps_customize_pane Android:id=@+id/apps_customize_pane android:layout_width=match_parent android:layout_height=match_parent android:visibility=invisible / 2.apps_customize_pane.xml中: com.android
1.Launcher.xml中: <include layout="@layout/apps_customize_pane" Android:id="@+id/apps_customize_pane" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="invisible" /> 2.apps_customize_pane.xml中: <com.android.launcher2.AppsCustomizeTabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" android:background="#FF000000"> <LinearLayout android:id="@+id/apps_customize_content" .... <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent"> <com.android.launcher2.AppsCustomizePagedView android:id="@+id/apps_customize_pane_content" .... 3.Launcher.java 中setupViews() { // Setup AppsCustomize mAppsCustomizeTabHost = (AppsCustomizeTabHost) findViewById(R.id.apps_customize_pane); mAppsCustomizeContent = (AppsCustomizePagedView) mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content); mAppsCustomizeContent.setup(this, dragController); } 4.mtk_apps_customize_application.xml中 <com.android.launcher2.MTKAppIcon xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" android:id="@+id/application_icon" .... <com.android.launcher2.PagedViewIcon style="@style/WorkspaceIcon.Landscape.AppsCustomize" android:id="@+id/app_customize_application_icon" .... 5.AppsCustomizePagedView.java 中syncAppsPageItems() { ApplicationInfo info = mApps.get(i); MTKAppIcon icon = (MTKAppIcon) mLayoutInflater.inflate( R.layout.mtk_apps_customize_application, layout, false); } 6.MTKAppIcon.java 中onFinishInflate() { mAppIcon = (PagedViewIcon)findViewById(R.id.app_customize_application_icon); } 7.PagedViewIcon.java为Launcher2.apk中应用程序图标的显示类。 ![]() (编辑:我爱制作网_潮州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |