Toolbar With Gradient Background Set Title Background Transparent
I defined a Gradient Drawable:
Solution 1:
You can also solve this by setting the background of the toolbar to your drawable.
mToolbar().setDrawable(R.drawable.your_gradient)
Solution 2:
link - Set transparent background of an imageview on Android
use this color in your color xml file and then give this color to your startcolor and end color
Solution 3:
The solution is to disable the title of the toolbar:
this.getSupportActionBar().setDisplayShowTitleEnabled(false);
and to add a custom TextView
:
<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.Toolbarxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:id="@+id/toolbar"android:layout_width="match_parent"android:layout_height="?android:attr/actionBarSize"android:elevation="2dp"android:focusable="false"android:popupTheme="@style/ThemeOverlay.AppCompat.Dark"app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"app:theme="@style/AppTheme.Toolbar" ><TextViewandroid:id="@+id/toolbar_title"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="start"android:background="@null"android:text="Toolbar Title"android:textColor="@color/white"android:textSize="20sp"android:textStyle="bold" /></android.support.v7.widget.Toolbar>
Solution 4:
Changing the background color to transparent in the style section should fix the issue
<stylename="AppTheme.Toolbar"parent="ThemeOverlay.AppCompat.Dark.ActionBar"><itemname="android:background">#00000000</item></style>
The question How to make title background transparent on android app had similar issue above solution did the trick. The android app was for Renesas RX130 and Texas Instrument CC2650 BLE solution. Bellow is solution after the fix.
Post a Comment for "Toolbar With Gradient Background Set Title Background Transparent"