2017-09-25 5 views
0

J'essaie d'aligner imageview à l'extrême gauche de ma barre d'outils, mais ce n'est pas le cas. J'ai essayé d'autres solutions sur stackoverflow, mais personne ne travaille pour moiAligner la disposition à l'extrême gauche à l'intérieur de la barre d'outils Android

check out this image

<android.support.v7.widget.Toolbar 
     android:id="@+id/my_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="#fff" 
     android:elevation="4dp" 
     android:gravity="start" 
     android:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:weightSum="10"> 

      <ImageView 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_gravity="start" 
       android:layout_weight="2" 
       android:padding="10dp" 
       android:src="@drawable/app_icon_book_sumary_one" /> 
     </LinearLayout> 
    </android.support.v7.widget.Toolbar> 
+0

cette image est-elle votre résultat? –

+0

Copie possible de [comment supprimer la marge gauche de la barre d'outils Android?] (Https://stackoverflow.com/questions/31063962/how-to-remove-left-margin-of-android-toolbar) –

Répondre

2

L'ajout de ces 2 lignes dans la barre d'outils travaillé

app:contentInsetLeft="0dp" 
app:contentInsetStart="0dp" 
+0

pour moi seulement la ligne déjà app: contentInsetStart = "0dp" a résolu le problème –

2

Définissez cet attribut sur votre barre d'outils

app:contentInsetStartWithNavigation="0dp 
+0

cela ne fonctionne pas ... barre d'outils est déjà à l'extrême gauche, mais dans le LinearLayout il y a une marge, je ne sais pas pourquoi –

+0

Je peux voir sur votre image que la barre d'outils n'est pas complètement aligné à gauche –

+0

mon curseur est sur LinearLayout afin qu'il montre le bordure de disposition linéaire. Lorsque le curseur est sur la barre d'outils, la bordure se déplace vers l'extrême gauche. :) –