Android Launcher View構架淺析

來源:互聯網
上載者:User

1. 先來看一下launcher activity view的架構圖(hierarchyviewer.bat工具擷取):

 

2. 再來看layout/launcher.xml, layout-port/launcher.xml,  layout-land/launcher.xml

 

 

<com.android.Launcher.DragLayer

    xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:launcher="http://schemas.android.com/apk/res/com.android.Launcher"

 

    android:id="@+id/drag_layer"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:background="#FFF">

 

    <!-- The workspace contains 3 screens of cells -->

    <com.android.Launcher.Workspace

        android:id="@+id/workspace"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

 

        launcher:defaultScreen="1">

 

        <include android:id="@+id/cell1" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell2" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell3" layout="@layout/workspace_screen" />

 

    </com.android.Launcher.Workspace>

 

    <SlidingDrawer

        android:id="@+id/drawer"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

 

        android:orientation="horizontal"

        android:bottomOffset="4dip"

        android:handle="@+id/all_apps"

        android:content="@+id/content">

 

        <com.android.Launcher.HandleView

            android:id="@id/all_apps"

            android:layout_width="56dip"

            android:layout_height="56dip"

 

            android:background="@drawable/handle"

 

            android:focusable="true"

            android:clickable="true"

 

            android:scaleType="center"

            android:src="@drawable/handle_icon"

 

 

            launcher:direction="vertical" />

 

        <com.android.Launcher.AllAppsGridView

            android:id="@id/content"

            android:layout_width="fill_parent"

            android:layout_height="fill_parent"

 

            launcher:texture="@drawable/pattern_carbon_fiber_dark"

 

            android:scrollbarStyle="outsideInset"

            android:drawSelectorOnTop="false"

            android:listSelector="@drawable/grid_selector"

 

            android:nextFocusLeft="@id/all_apps"

            android:nextFocusDown="@id/content"

            android:nextFocusUp="@id/content"

            android:nextFocusRight="@id/content"

 

            android:verticalSpacing="10dip"

            android:numColumns="5" />

 

    </SlidingDrawer>

 

    <com.android.Launcher.DeleteZone

        android:id="@+id/delete_zone"

        android:layout_width="49dip"

        android:layout_height="wrap_content"

 

        android:scaleType="center"

        android:src="@drawable/ic_delete"

        android:background="@drawable/delete_zone_selector"

 

        android:layout_marginBottom="-25dip"

        android:layout_gravity="right|center_vertical"

        android:visibility="gone"

 

        launcher:direction="vertical" />

 

</com.android.Launcher.DragLayer>

 

 

 

3. 呈現介面:()

 

 

其中Workspace可增加到任意多個cell,如7個:

        launcher:defaultScreen="3">

 

        <include android:id="@+id/cell1" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell2" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell3" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell4" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell5" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell6" layout="@layout/workspace_screen" />

        <include android:id="@+id/cell7" layout="@layout/workspace_screen" />

 

 

轉載請註明:http://blog.csdn.net/ccwwff/archive/2011/01/05/6118618.aspx

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.