【问题标题】:How do I remove this distance in the toolbar?如何在工具栏中删除此距离?
【发布时间】:2023-03-29 11:10:01
【问题描述】:

我没有使用任何填充或边距的代码。但是有这个距离。我怎样才能删除这个距离? ..................................................... .....................

这是我的代码>

<android.support.design.widget.AppBarLayout
    android:id="@+id/appBarLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_scrollFlags="scroll|enterAlways">

        <ImageView
            android:id="@+id/back_arrow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:background="?attr/selectableItemBackground"
            android:clickable="true"
            android:focusable="true"
            android:src="@drawable/ic_arrow_forward_white_24dp" />

        <TextView
            android:id="@+id/toolbar_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:ellipsize="end"
            android:singleLine="true"
            android:textColor="@color/grey_50"
            android:textSize="18sp" />
    </android.support.v7.widget.Toolbar>

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


<include layout="@layout/content_news" />

【问题讨论】:

    标签: padding android-toolbar appbar


    【解决方案1】:

    更新您在 ImageView 标记中写入的以下行。

    使用

     android:layout_gravity="end"
    

    而不是

     android:layout_gravity="start"
    

    【讨论】:

      【解决方案2】:

      问题出在线路上。

      getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
      

      【讨论】:

        猜你喜欢
        • 2015-09-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-08
        • 1970-01-01
        • 2016-11-13
        • 1970-01-01
        相关资源
        最近更新 更多