0
votes

Comment éliminer l'écart de l'icône lors du flotteur laissé dans la mise en page relative?

Je veux retirer l'écart à gauche de button_history, mais cela ne fonctionne pas.

J'ai essayé d'utiliser android: layout_alignparentStart = "vrai" pour aligner la touche_history à gauche mais toujours non travaillé.

L'icône à gauche a une lacune.

ci-dessous est mon code XML. xxx

Je m'attends à ce qu'il n'y ait pas d'espace sur le bouton gauche_history


0 commentaires

3 Réponses :


0
votes

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"


0 commentaires

0
votes

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 app: contentInsetleft = "0DP" forte> et app: contentInsetstart = "0 dp" strud>

Code complet est: strong> p>

<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>


0 commentaires

0
votes

Appliquez cet attribut à votre barre d'outils: xxx


0 commentaires