9
Mã của tôi là:Thay đổi thanh công cụ đề tài lập trình
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:theme="@style/Toolbar_Theme"/>
Tôi muốn thay đổi ứng dụng: chủ đề trong mã java. Tôi có thể tìm thấy bất kỳ phương pháp nào là toolbar.setTheme
được sử dụng để thay đổi kiểu thanh công cụ không?
Bạn chỉ có thể thay đổi màu nền và mã màu tiêu đề sử dụng: toolbar.setBackgroundColor (newColor); toolbar.setTitleTextColor (titleColor); – Lazai
@Lazai cảm ơn bạn –
Hãy thử cách này: https://stackoverflow.com/questions/31225189/how-to-change-appcompat-v21-toolbar-theme-programmatically –