一些产品在横屏使用时,也希望hotseat在屏幕的下方。一个朋友问具体是怎么做的。我现在把我目前做的写在下面,希望对要做这件事的人有所帮助。
diff -r res//layout-land/launcher.xml /home/hu/原始的代码/Gingerbread/packages/apps/Launcher2/res//layout-land/launcher.xml
< android:layout_height="fill_parent"
< android:layout_width="@dimen/button_bar_height_portrait"
< android:layout_gravity="right|center_vertical"
---
> android:layout_height="@dimen/button_bar_height"
> android:layout_width="fill_parent"
> android:layout_gravity="bottom|center_horizontal"
< launcher:direction="vertical"
---
> launcher:direction="horizontal"
>
> <ImageView
> android:id="@+id/hotseat_left1"
> style="@style/HotseatButton"
> android:layout_toLeftOf="@id/all_apps_button"
> android:src="@drawable/hotseat_phone"
> android:onClick="launchHotSeat"
> />
>
> <ImageView //我扩展了一些 hotseat 。 只留了一个当例子。
> android:id="@+id/hotseat_left"
> style="@style/HotseatButton.Left"
> android:layout_toLeftOf="@id/hotseat_left1"
> android:src="@drawable/hotseat_namecard"
> android:onClick="launchHotSeat"
> />
>
> <ImageView
> android:id="@+id/hotseat_right1"
> style="@style/HotseatButton"
> android:layout_toRightOf="@id/all_apps_button"
>
> android:src="@drawable/hotseat_call_log"
>
> android:onClick="launchHotSeat"
diff -r res//layout-land/workspace_screen.xml /home/hu/原始的代码/Gingerbread/packages/apps/Launcher2/res//layout-land/workspace_screen.xml
27,32c27,32
< launcher:longAxisStartPadding="65dip"
< launcher:longAxisEndPadding="65dip"
< launcher:shortAxisStartPadding="0dip"
< launcher:shortAxisEndPadding="0dip"
< launcher:shortAxisCells="4"
< launcher:longAxisCells="4" />
---
> launcher:longAxisStartPadding="6dip" // 这个可以任意调整
> launcher:longAxisEndPadding="6dip"
> launcher:shortAxisStartPadding="1dip"
> launcher:shortAxisEndPadding="1dip"
> launcher:shortAxisCells="6"
> launcher:longAxisCells="6" />
diff -r res//values/arrays.xml /home/hu/原始的代码/Gingerbread/packages/apps/Launcher2/res//values/arrays.xml
3a4
> <item>intent:#Intent;action=com.android.contacts.action.LIST_CONTACTS;end</item>
5c6,7
< <item>*BROWSER*</item>
---
> <item>intent:#Intent;action=com.android.phone.action.RECENT_CALLS;end</item>
> <item>intent:#Intent;action=com.android.schedule.action.XXXX_SCHEDULE</item> //扩展了hotseat上按键的intent参数
8,9c10,13
< <item>@drawable/hotseat_phone</item>
< <item>@drawable/hotseat_browser</item>
---
> <item>@drawable/hotseat_namecard</item> // Launcher启动后,Launcher.java还要重新初始化界面。
> <item>@drawable/hotseat_inner_phone</item>
> <item>@drawable/hotseat_call_log</item>
> <item>@drawable/hotseat_schedule</item>
diff -r res//values-land/styles.xml /home/hu/原始的代码/Gingerbread/packages/apps/Launcher2/res//values-land/styles.xml
22,23c22,23
< <item name="android:paddingTop">12dip</item>
< <item name="android:paddingBottom">12dip</item>
---
> <item name="android:paddingTop">2dip</item>
> <item name="android:paddingBottom">2dip</item>
25,26c25,26
< <item name="android:layout_height">wrap_content</item> //这就是那个朋友问的问题。
< <item name="android:layout_width">fill_parent</item>
---
> <item name="android:layout_height">fill_parent</item>
> <item name="android:layout_width">wrap_content</item>
32c32
< <item name="android:layout_marginBottom">4dip</item>
---
> <item name="android:layout_marginBottom">0dip</item>
36c36
< <item name="android:layout_marginTop">4dip</item>
---
> <item name="android:layout_marginTop">0dip</item>
diff -r res//xml/default_workspace.xml /home/hu/原始的代码/Gingerbread/packages/apps/Launcher2/res//xml/default_workspace.xml
47,48c47,48
< launcher:packageName="com.android.music"
< launcher:className="com.android.music.MediaAppWidgetProvider"
---
> launcher:packageName="com.android.xxx_calendar.widget"
> launcher:className="com.android.xxx_calendar.widget.Calendar_widget" //希望开机就加载自己的AppWidget。这个还不对,哪个朋友知道原因,请赐教。