Launcher修改–修改底部表徵圖

來源:互聯網
上載者:User

        在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;
有關他們的代碼全部屏蔽以後,重新編譯下,完成效果。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.