简体   繁体   English

如何在 Android Studio 中将 ActionBar 标题居中?

[英]How do I center the ActionBar title in Android Studio?

I want to center the ActionBar title text in my app...我想在我的应用程序中将ActionBar标题文本居中...

I understand I need a custom layout to do this... So how do I do it?我知道我需要一个自定义布局来做到这一点......那么我该怎么做呢?

I've tried following the instructions from here - How to center align the ActionBar title in Android?我已经尝试按照这里的说明操作 - 如何在 Android 中居中对齐 ActionBar 标题? - ——

but it's not clear where to put the code.但不清楚将代码放在哪里。 I tried my best to follow the steps, but my action bar stayed exactly the same.我尽力按照步骤操作,但我的操作栏保持完全相同。

Thanks.谢谢。

Base API for my app is 16.我的应用程序的基本 API 是 16。

ActionBar with Custom View will help you. 带有自定义视图的 ActionBar将为您提供帮助。 It is clear and easy to follow.它清晰易懂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM