Je veux retirer l'écart à gauche de button_history, mais cela ne fonctionne pas.
J'ai essayé d'utiliser android: layout_alignparentStart = "vrai" code> pour aligner la touche_history à gauche mais toujours non travaillé. P>
3 Réponses :
Le problème est due au fait que le comportement par défaut des barres d'outils est d'ajouter de l'espace blanc entre la frontière et où le relativation commence. Pour résoudre ce problème, ajoutez ce qui suit à votre barre d'outils.
app:contentInsetLeft="0dp" app:contentInsetStart="0dp"
Par défaut Barre d'outils Ajoutez de l'espace blanc afin d'ignorer ou de supprimer ces espaces blancs, nous pouvons ajouter cette ligne de code dans la barre d'outils dans la présentation XML <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fireTopLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorDrowzyBg"
android:keepScreenOn="true"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/action_bar"
android:elevation="4dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button_close"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentEnd="true"
android:background="@drawable/ic_close" />
<Button
android:id="@+id/button_history"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentStart="true"
android:background="@drawable/ic_list" />
<TextView
android:id="@+id/text_view_countdown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="00:00"
android:textColor="@android:color/black"
android:textSize="30sp" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
</RelativeLayout>
Appliquez cet attribut à votre barre d'outils: