首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将工具栏标题和副标题设置为中心

如何将工具栏标题和副标题设置为中心
EN

Stack Overflow用户
提问于 2019-03-27 04:38:22
回答 1查看 274关注 0票数 0

在我的例子中,我想将工具栏标题和副标题设置在中间。我已经有了一个在工具栏中设置自定义布局的解决方案。这是否还有其他不使用自定义布局来设置工具栏标题和字幕的解决方案?

解决方案1:

代码语言:javascript
复制
<android.support.v7.widget.Toolbar
    android:id="@+id/custom_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/actionBarSize"
    android:background="@android:color/holo_red_dark">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="abc"
        android:textColor="@android:color/white"
        android:textSize="20sp"
        android:layout_marginRight="?android:attr/actionBarSize"
        android:gravity="center"/>

    </android.support.v7.widget.Toolbar>

我不想使用自定义布局设置工具栏标题和字幕,我感谢您的努力,提前。

EN

回答 1

Stack Overflow用户

发布于 2019-03-27 04:39:47

代码语言:javascript
复制
<android.support.v7.widget.Toolbar
    android:id="@+id/custom_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/actionBarSize"
    android:background="@android:color/holo_red_dark">        
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="abc"
        android:textColor="@android:color/white"
        android:textSize="20sp"
        android:layout_marginRight="?android:attr/actionBarSize"
        android:gravity="center"/>

</android.support.v7.widget.Toolbar>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55369912

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档