Dan*_*son 5 android android-actionbar
我正在使用菜单项创建自己的操作栏,因此使用Theme.AppCompat.Light.NoActionBar.
我希望操作栏呈紫色,标题颜色为白色,但此刻它是黑色的.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我的动作栏xml是:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:id="@+id/app_bar"
>
Run Code Online (Sandbox Code Playgroud)
正如此Google+专业提示中所述,您可以使用a ThemeOverlay来仅自定义某些内容.当您需要在深色背景上制作文字灯时,这非常有用,这可以通过添加android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"到您的Toolbar:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:id="@+id/app_bar"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
Run Code Online (Sandbox Code Playgroud)
在Theming with AppCompat blog + video中进一步讨论了这种技术.
| 归档时间: |
|
| 查看次数: |
2720 次 |
| 最近记录: |