2017-07-29 1 views
-1

Je voudrais supprimer padding gauche dans ActionBar entre le hamburger & le titre sans avoir à utiliser les barres d'outils. J'ai essayé des barres d'outils mais j'ai rencontré des limitations que j'ai senties étaient des inconvénients. Je suis nouveau dans la programmation Android et j'apprécierais une solution propre à cela en utilisant le ActionBar par défaut.Suppression Padding entre hamburger et Titre

enter image description here

Répondre

2

essayer cette utilisation ci-dessous propriété de la barre d'outils

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

vous maintenant définir toolbar comme celui-ci

<android.support.design.widget.CoordinatorLayout 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.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" 
     app:contentInsetLeft="0dp" 
     app:contentInsetStart="0dp" 
     app:contentInsetStartWithNavigation="0dp" /> 

</android.support.design.widget.AppBarLayout> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    // add here all your controlls 
</LinearLayout> 

</android.support.design.widget.CoordinatorLayout> 

barre d'outils maintenant définir l'activité comme celui-ci

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

me demander dans le cas d'une requête

+0

Merci pour la réponse. Kinly expliquer sur l'application suivante: titleTextAppearance = "@ style/Toolbar.TitleText" application: popupTheme = "@ style/AppTheme.PopupOverlay" – jmsiox

+0

@ jmsiox ne vous a pas ..? –

+0

Je suis bloqué à l'ajout des styles pour la barre d'outils que mon texte n'est plus visible après le passage à la barre d'outils .. – jmsiox