2016-11-07 10 views
0
にツールバーの背景に

を画像を追加します。は、私がこのような何かをやろうとしているAndroidの

をツールバーの私の現在のコード:

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/toolbar" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    android:fitsSystemWindows="true" 
    android:minHeight="?attr/actionBarSize" 
    app:theme="@style/MyTheme.ActionBarStyle" 
    android:background="@android:color/transparent"> 

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_marginLeft="-10dp" 
     android:gravity="center"> 
     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/explore_morning" 
      android:contentDescription="@string/app_name" /> 
    </RelativeLayout> 

</android.support.v7.widget.Toolbar> 

私の画像が画面全体をカバーしていません

答えて

1

新しい画像表示を追加する代わりに、ツールバーの背景を設定すると問題が解決しました。

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/explore_morning" 
    android:fitsSystemWindows="true" 
    android:minHeight="64dp" 
    app:theme="@style/MyTheme.ActionBarStyle"> 


</android.support.v7.widget.Toolbar> 
関連する問題