如何居中CollapsingToolbarLayout的标题? [英] How to center the title of a CollapsingToolbarLayout?

查看:274
本文介绍了如何居中CollapsingToolbarLayout的标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了setExpandTitleTextAppearance,但是没有用.我想将扩展的标题文本居中.

I tried setExpandTitleTextAppearance, but it didn't work. I want to center the expanded title text.

推荐答案

有一个属性expandedTitleGravity,您可以将其与CollapsingToolbarLayout一起使用,以使展开的标题文本居中.将此添加到您的CollapsingToolbarLayout:

There is an attribute expandedTitleGravity that you can use with the CollapsingToolbarLayout to center the expanded title text. Add this to your CollapsingToolbarLayout:

app:expandedTitleGravity="bottom|center_horizontal"

这篇关于如何居中CollapsingToolbarLayout的标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆