oja*_*jas 14 android android-xml android-styles android-toolbar
我的工具栏文本,后退箭头和所有颜色都是黑色但我希望它是白色
我怎样才能实现它?
我的styles.xml看起来像这样:
<resources>
<style name="AppTheme" parent="MyMaterialTheme.Base">
</style>
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/windowBackground</item>
<item name="android:textColor">@color/textColorPrimary</item>
<item name="android:textStyle">normal</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
Android Manifest代码段:
<application
android:allowBackup="true"
android:icon="@mipmap/hello"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
Run Code Online (Sandbox Code Playgroud)
Dev*_*rim 24
为工具栏定义样式:
<style name="AppToolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:textColorSecondary">@android:color/white</item>
</style>
Run Code Online (Sandbox Code Playgroud)
将其设置为您的工具栏:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:theme="@style/AppToolbar"
android:minHeight="?attr/actionBarSize"/>
Run Code Online (Sandbox Code Playgroud)
Sur*_*gch 10
如果您使用工具栏使用ThemeOverlay.AppCompat.Dark.ActionBar样式,文本将会很轻.请参阅此答案了解更多信息
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11743 次 |
| 最近记录: |