我定义了一个Gradient Drawable:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:endColor="#2F3F59"
android:startColor="#4078A7"
android:type="linear"
android:angle="90" />
</shape>
然后我将它设置在我的工具栏上:
<style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColorPrimary">@color/textcolorsecundary</item>
<item name="actionMenuTextColor">@color/textcolorsecundary</item>
<item name="android:textColorSecondary">@color/textcolorsecundary</item>
<item name="android:background">@drawable/custom_background_blue</item>
</style>
这个是有效的!但是:
标题会出现相同的渐变效果,这看起来非常难看,因此我必须更改它。如何将信息文本的背景设置为透明?