tôi có một thanh công cụ trong ứng dụng của tôi như thế:Android - Trung tâm tiêu đề của Toolbar
<?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" />
Và tôi thêm tiêu đề như:
getSupportActionBar().setTitle(title);
Tôi đã đọc rằng Android toolbar center title and custom font
Nhưng nếu tôi thay đổi xml của thanh công cụ, tôi không biết cách thay đổi giá trị của TextView. Ai đó có thể giúp tôi ?
Sử dụng rằng câu trả lời khác, và sử dụng findViewById để lấy TextView – Knossos
@Knossos Cảm ơn :) – benjyspider