[英]Android actionbar title - change background color
在頂部的Android工具欄中,我在背景上使用漸變色。 它工作正常,但我注意到標題包裹在繼承了另一種漸變顏色的內容中。 如何將標題的背景更改為透明?
<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突出的背景色。
添加帶有標題的自定義工具欄。
<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.