Je souhaite définir une image comme arrière-plan de ma barre d'outils, avec l'image mise à l'échelle. Pour une raison quelconque, l'image s'affiche juste en dessous de la barre d'outils. et je ne suis pas sûr pourquoi. Toute aide serait grandement appréciée. J'ai essayé plusieurs des façons dont les gens ont suggéré en ligne et aucun d'entre eux ne donne le résultat que je recherche.Xamarin Android - Définir l'arrière-plan de la barre d'outils comme une image, ne fonctionne pas comme prévu
Également: La définition de l'arrière-plan par programme a le même résultat.
Voici mon code de la vue avec l'arrière-plan défini sur l'image
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_nav_drawer_layout"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/main_nav_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@drawable/header_bg"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<FrameLayout
android:id="@+id/app_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/main_nav_view"
android:background="#D3D2D2"
app:itemBackground="@drawable/style_menu_bg_color"
app:menu="@menu/main_menu"
app:headerLayout="@layout/main_menu_header"
app:itemTextColor="@drawable/style_menu_text_color"
app:itemIconTint="@drawable/style_menu_text_color" />
</android.support.v4.widget.DrawerLayout>
J'ai aussi essayé de cette façon avec un ImageView dans la ToolBar
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_nav_drawer_layout"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/main_nav_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/header_bg"/>
</android.support.v7.widget.Toolbar>
<FrameLayout
android:id="@+id/app_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/main_nav_view"
android:background="#D3D2D2"
app:itemBackground="@drawable/style_menu_bg_color"
app:menu="@menu/main_menu"
app:headerLayout="@layout/main_menu_header"
app:itemTextColor="@drawable/style_menu_text_color"
app:itemIconTint="@drawable/style_menu_text_color" />
</android.support.v4.widget.DrawerLayout>