0

我想在操作栏上的应用程序图标之前有一个自定义视图。正如您在 facebook 中看到的那样,该自定义视图实际上是菜单按钮。我也想要UP按钮,即主页按钮。那么我们是否可以在应用程序图标的左侧放置一个图标,或者以其他方式将其他图像显示为应用程序图标,但该图像不应该在应用程序抽屉中看到?

4

1 回答 1

0

最后,我得到了一些解决方法。我将自定义视图应用于我的操作栏并删除了应用程序图标。并在我的自定义视图上有一个带有应用程序图标的图像视图。对于那些感兴趣的人,这就是我在操作栏 xml 上的自定义视图的样子:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent">

<ImageView
    android:id="@+id/iv_menu"
    android:onClick="onClick"
    android:paddingLeft="14dip"
    android:paddingRight="14dip"
    android:layout_gravity="center_vertical"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:background="@drawable/menu_button"
    android:src="@drawable/ic_menu_off" />

<ImageView
    android:id="@+id/iv_separator"
    android:layout_gravity="center_vertical"
    android:layout_toRightOf="@id/iv_menu"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:background="@drawable/separator1"/>

<ImageView
    android:id="@+id/iv_logo"
    android:layout_marginLeft="10dip"
    android:layout_toRightOf="@id/iv_separator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/ic_app_icon" />       

</RelativeLayout>
于 2012-08-02T07:40:41.177 回答