【问题标题】:How can I padding right hamburger button in Android Toolbar?如何在 Android 工具栏中填充右汉堡按钮?
【发布时间】:2021-03-07 23:41:39
【问题描述】:

如何将 Android 工具栏中的汉堡包按钮从左到右从 1 填充到 2?

【问题讨论】:

  • 我认为您需要将其向右对齐,而不是添加填充 .. 因为根据支持的屏幕宽度,设备之间的填充会有所不同。
  • @Zain 我们可以在工具栏中使用“android:gravity="end|center_vertical"”吗?
  • 是的,但在这种情况下,您将为操作栏使用自定义工具栏
  • @是的,我明白了,tnx 这么多通知我 :)

标签: android android-toolbar


【解决方案1】:

对于 AppBarLayout 和 Toolbar 你可以使用:

<android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        android:layoutDirection="rtl">

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


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

【讨论】:

  • 你明白问题吗?
猜你喜欢
  • 1970-01-01
  • 2017-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-20
相关资源
最近更新 更多