展会信息港展会大全

Launcher修改--Android修改底部图标
来源:互联网   发布日期:2016-01-06 19:24:56   浏览:3594次  

导读:在android2.2中,launcher的底部被修改成这种模式,有时候修改launcher的时候需要去掉电话和浏览器两项,我们可以在res/layout-port/文件夹中找到launcher.xml文件,在其中有以下代码RelativeLayoutandroid:id=......

在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;

有关他们的代码全部屏蔽以后,重新编译下,完成效果。

赞助本站

人工智能实验室

相关热词: 底部图标

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港