在android2.2中,launcher的底部被修改成
这种模式,有时候修改launcher的时候需要去掉电话和浏览器两项,我们可以在res/layout-port/文件夹中找到launcher.xml文件,在其中有以下代码
<RelativeLayout
android:id="@+id/all_apps_button_cluster"
android:layout_width="fill_parent"
android:layout_height="@dimen/button_bar_height"
android:layout_gravity="bottom|center_horizontal"
android:paddingTop="2dip"
>
<com.android.launcher2.HandleView
style="@style/HotseatButton"
android:id="@+id/all_apps_button"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:src="@drawable/all_apps_button"
launcher:direction="horizontal"
/>
<ImageView
android:id="@+id/hotseat_left"
style="@style/HotseatButton.Left"
android:layout_toLeftOf="@id/all_apps_button"
android:src="@drawable/hotseat_phone"
android:onClick="launchHotSeat"
/>
<ImageView
android:id="@+id/hotseat_right"
style="@style/HotseatButton.Right"
android:layout_toRightOf="@id/all_apps_button"
android:src="@drawable/hotseat_browser"
android:onClick="launchHotSeat"
/>
</RelativeLayout>
下面的两个ImageView控件就是左右的两个,一个电话,一个浏览器图标,在这里,你可以把这两个图标更换为其他功能,当然,具体功能实现得在Launcher.java代码中实现,如果想去掉这些图标,把上面那段代码删除,但是别忘了下面的Launcher.java中的代码。
hotseatLeft = (ImageView) findViewById(R.id.hotseat_left);
hotseatLeft.setContentDescription(mHotseatLabels[0]);
hotseatLeft.setImageDrawable(mHotseatIcons[0]);
hotseatRight = (ImageView) findViewById(R.id.hotseat_right);
hotseatRight.setContentDescription(mHotseatLabels[1]);
hotseatRight.setImageDrawable(mHotseatIcons[1]);
屏蔽掉,当然还有他们的声明代码。
private ImageView hotseatLeft;
private ImageView hotseatRight;
有关他们的代码全部屏蔽以后,重新编译下,完成效果。
本文介绍如何在Android 2.2系统的Launcher中移除底部预设的电话和浏览器图标,并提供了具体的XML布局文件及Java代码修改方法。
385

被折叠的 条评论
为什么被折叠?



