2012-06-19 70 views
1

我有一個自定義佈局的操作欄,但是這顯示了我在右邊的圖標,我設置了false texttitle,description和uselogo。帶自定義佈局的操作欄顯示我的圖標

照片:

a busy cat http://img155.imageshack.us/img155/6742/sinttulozmk.png

這是我的代碼:

// 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,只有一個圖像,2 TextView的和其他的圖像。

<?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> 

我用動作條福爾摩斯和2.3

+0

請提供操作欄xml文件.......... –

+0

做到這一點,我編輯我的問題 – rbrlnx

+0

這個圖標是在這個XML?因爲我沒有可繪製的,所以不能檢測......看起來像header_bt_off? –

回答

6

您可以使用actionbar.setDisplayShowHomeEnabled(false)隱藏圖標。