android - 如何在保持菜单结束的同时将 AndroidX 工具栏文本居中对齐?
问题描述
我想将我ToolBar Text
的中心对齐,同时将三点菜单保留在最后,但我找不到办法做到这一点。每当我改变重力时,整个重力都会发生变化。
布局代码:
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_alignParentStart="true"
android:layout_gravity="center|top"
android:background="#fff"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="wrap_content"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="end"
android:background="#fff"
app:title="CENTER">
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
解决方案
将它们的宽度设置match_parent
为。
推荐阅读
- sql-server - 在将 EF6 从 SQL Server 迁移到 Oracle 时。“Oracle Data Provider for .NET 不支持时间”得到这个问题
- r - 在 R 中随机采样不规则的栅格范围
- regex - 我需要一个正则表达式来提取分隔符之间的特定字符
- jenkins-pipeline - 如何在 Jenkins 管道中的 zip 文件管道实用程序插件中排除 Jenkinsfile 和自动化脚本
- uvm - 在模拟运行时更改 uvm 详细程度
- python - Pandas Dataframe 时移列
- leaflet - 传单层在缩小时格式不正确
- python - python的舍入问题(实现Karatsuba的算法)
- c - 原始以太网 MAC 目标地址
- jquery - Jquery Chosen - 销毁方法不起作用