我的應用程序的主題是這樣的:標籤是不是被顯示在操作欄中
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/background</item>
</style>
意味着沒有行動起來吧。但我想一個活動只有一個操作欄,但沒有狀態欄,所以我創建該活動樣式:
<style name="chapter_theme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/background</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/background</item>
</style>
而且清單文件:
<activity
android:name=".ChapterOne"
android:theme="@style/chapter_theme"
android:label="Chapter One">
</activity>
擺脫現狀酒吧,我添加了下面的代碼在活動的java文件:
// To remove status bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_chapter_one);
不能找出什麼是錯的
編輯:我知道什麼是錯的。操作欄和標題的顏色是白色的,所以沒有人能看到寫在那裏的標題。我改變了操作欄的背景顏色。
現在我想知道如何改變標題的顏色?
要在工具欄 –
顯示標籤工具欄 –
不,我沒有是啊,爲什麼我應該 –