gpt4 book ai didi

android - 如何在操作栏的水平中心设置文本

转载 作者:太空狗 更新时间:2023-10-29 15:14:20 27 4
gpt4 key购买 nike

我想在操作栏的水平中心设置文本,我想放置如下图所示的按钮。

如何在操作栏的水平中心设置文本?

我可以更改操作栏的图标而不是我的吗?

enter image description here

最佳答案

为操作栏使用您自己的 XML 布局。使用您想要的任何布局将文本设置在中心。

在您的oncreate 方法中:

getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); 
getSupportActionBar().setCustomView(R.layout.your_layout);

关于android - 如何在操作栏的水平中心设置文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13945483/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com