Zap*_*ica 14 android android-support-library android-toolbar
我最近更新了我的Android支持库昨天到版本 23.2.0
并且所有前Lolipop设备突然将后箭头,汉堡包和(三点菜单)的颜色改为黑色.当他们总是白色的时候.
棒棒糖设备似乎很好.
这是我style.xml在更新之间根本没有编辑过的.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
<item name="colorAccent">@color/accentColor</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
</style>
<!-- Theme to customise the tool bar -->
<style name="MyCustomToolBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="textColorPrimary">@color/textColorWhite</item>
<!-- Added this now to test, still nothing --!>
<item name="colorControlNormal">@color/textColorWhite</item>
</style>
<style name="MyApp.MyCustomToolBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar">
<!--to add-->
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
然后这是我的工具栏布局
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:background="@color/primaryColor"
app:theme="@style/MyCustomToolBarTheme"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark">
</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)
这是一个AppCompat错误.要解决此问题,请更新gradle以使用vector drawables:
// Gradle Plugin 2.0+
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
Run Code Online (Sandbox Code Playgroud)
早期的gradle:
// Gradle Plugin 1.5
android {
defaultConfig {
generatedDensities = []
}
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:您不再需要根据Android博客设置标志.这已在23.2.1中修复.
对于AppCompat用户,使用AppCompat不再需要23.2 博客文章中描述的用于启用支持向量drawable的标志.但是,如果您希望将支持向量drawable用于您自己的资源,您仍然可以利用app:srcCompat属性.
立即解决方案:更新您的支持库以使用23.2.1或更高版本,如下所示:
dependencies {
compile 'com.android.support:appcompat-v7:23.2.1'
}
Run Code Online (Sandbox Code Playgroud)
我有同样的问题,现在看来这个bug已经修复了支持库23.2.1+.因此,您只需更新Android支持库并在build.gradle中更改appcompat版本号
dependencies {
compile 'com.android.support:appcompat-v7:23.2.1'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1386 次 |
| 最近记录: |