私は、アプリのほとんどが軽いテーマを使用しているinstagramのようなアプリデザインを実現しようとしています。しかし、ナビゲーション・ドロワーやバック・ボタン・ブラックのようなツールバー・テキストやアイコン要素を色付けする方法は見つけられませんでした。styles.xmlのAndroidツールバーの色固有の項目
次style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#FAFAFA</item>
<item name="colorPrimaryDark">#BDBDBD</item>
<item name="colorAccent">#FF4081</item>
</style>
<style name="AppTheme" parent="AppTheme.Base"></style>
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
<!-- Used to for the title of the Toolbar -->
<item name="android:textColorPrimary">@color/black</item>
<!-- Used to for the title of the Toolbar when parent is Theme.AppCompat.Light -->
<item name="android:textColorPrimaryInverse">@color/black</item>
<!-- Used to color the text of the action menu icons -->
<item name="android:textColorSecondary">@color/black</item>
<!-- Used to color the overflow menu icon -->
<item name="actionMenuTextColor">@color/black</item>
</style>
</resources>
とツールバーのため、この属性使用:することができますように
:
android:theme="@style/ToolbarTheme"
が、それは次のようなデザインを生成します参照してください、ナビゲーションドロワーは白で、タブのタイトルは白も。
私はまた、正常に動作します。このスタイルを試してみましたが、あなたは明示的にこのようなあなたの活動のツールバー設定しない場合にのみ:
アクティビティコード:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Style.xml:
を明示的なツールバーを使用しないでこのスタイルを使用すると、デザインは私が望むように見えますが、私はこの方法でツールバーを呼び出すことはできません。 Theme.AppCompat.Lightを使用してツールバーを設定すると、エラーが発生します。 Theme.AppCompat.Light.NoActionBar
対Theme.AppCompat.Lightこれを行う方法上の任意のアイデア:
はまた、2つのスタイルの違いに注意してください?