Android 带有自定义布局的“显示我”图标的操作栏

Android 带有自定义布局的“显示我”图标的操作栏,android,android-actionbar,actionbarsherlock,Android,Android Actionbar,Actionbarsherlock,我有一个自定义布局的actionbar,但这显示了右边的图标,我设置了false文本标题、描述和uselogo 照片: 这是我的代码: // Gestion del ActionBar y contexto ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayUseLog

我有一个自定义布局的actionbar,但这显示了右边的图标,我设置了false文本标题、描述和uselogo

照片:

这是我的代码:

    // Gestion del ActionBar y contexto
        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
        View cView = getLayoutInflater().inflate(R.layout.actionbar, null);
        actionBar.setCustomView(cView);
这是actionbar.xml,只有一个图像、两个文本视图和其他图像

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="54dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/header_bg" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="100dp"
            android:text="Nº de Usuario: "
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/blanco"
            android:textSize="12sp" android:shadowColor="#232323" android:shadowDx="0" android:shadowDy="-1"/>

        <TextView
            android:id="@+id/tvABCodigoUsuario"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/textView1"
            android:layout_alignBottom="@+id/textView1"
            android:layout_toRightOf="@+id/textView1"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/blanco"
            android:textSize="12sp" android:shadowColor="#232323" android:shadowDx="0" android:shadowDy="-1"/>

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:src="@drawable/header_logo" android:layout_marginLeft="14dp"/>

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:src="@drawable/header_bt_off" android:layout_marginRight="14dp"/>

        <TextView
            android:id="@+id/TextView02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@+id/textView1"
            android:layout_alignLeft="@+id/textView1"
            android:paddingRight="9dp"
            android:text="Nombre: "
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/blanco"
            android:textSize="12sp" android:layout_marginLeft="45dp" android:layout_marginBottom="1dp" android:shadowColor="#232323" android:shadowDx="0" android:shadowDy="-1"/>

    </RelativeLayout>

</RelativeLayout>


我使用actionbar sherlock和2.3

您可以使用
actionbar.setDisplayShowHomeEnabled(false)
隐藏图标。

您可以使用
actionbar.setDisplayShowHomeEnabled(false)
隐藏图标。

请提供actionbar xml文件…….此图标是否在此xml中?由于我没有绘图功能,所以无法检测……看起来像标题?不,此图标是应用图标不在XMLpower按钮中(右侧图标)是应用图标?抱歉,您可以尝试最后一个setDisplayShowHomeEnabled(false)…请提供actionbar xml文件………此图标是否在此xml中?由于我没有绘图功能,因此无法检测……看起来是页眉关闭?不,此图标是应用图标不在XMLpower按钮中(右侧图标)是应用图标?抱歉,您可以尝试最后一个setDisplayShowHomeEnabled(false)。。