歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Launcher2主菜單應用圖標顯示於整體布局中之說明

Launcher2主菜單應用圖標顯示於整體布局中之說明

日期:2017/3/1 9:55:24   编辑:Linux編程

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

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中應用程序圖標的顯示類。

更多Android相關信息見Android 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=11

Copyright © Linux教程網 All Rights Reserved