小编ben*_*der的帖子

Android - 中心工具栏的标题

我的应用程序中有一个工具栏,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="#263355"
    local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
Run Code Online (Sandbox Code Playgroud)

我添加标题:

getSupportActionBar().setTitle(title);
Run Code Online (Sandbox Code Playgroud)

我已经阅读了Android工具栏中心标题和自定义字体

但是,如果我更改工具栏的xml,我不知道如何更改TextView的值.有人可以帮帮我吗?

java android toolbar title

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

java ×1

title ×1

toolbar ×1