[英]Android actionbar title - change background color
In my Android toolbar on the top I'm using gradient colors on the background. 在顶部的Android工具栏中,我在背景上使用渐变色。 It works just fine, but I noticed the title is wrapped inside something that inherits another one of the gradient colors.
它工作正常,但我注意到标题包裹在继承了另一种渐变颜色的内容中。 How can I change the background of the title into transparent?
如何将标题的背景更改为透明?
<style name="Toolbar" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<item name="android:background">@drawable/toolbar_gradient</item>
</style>
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
app:titleTextColor="@color/white"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/Toolbar"/>
[..[ x ] ... y ]
[.. [x] ... y]
So the container x wraps the title and has a background color that stands out from the toolbar y. 因此,容器x包装了标题,并具有从工具栏y突出的背景色。
Add your custom toolbar with title. 添加带有标题的自定义工具栏。
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
app:titleTextColor="@color/white"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/Toolbar">
<TextView android:id="@+id/footer" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textSize="25sp"
android:singleLine="true" android:background="#07000000"
android:textColor="#FFFFFF" android:text="rrrrr"
android:layout_centerInParent="true"
android:layout_alignParentBottom="true" />// set your background as you wish
</android.support.v7.widget.Toolbar>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.