views:

59

answers:

1

Hi,

I've created a custom titlebar for an Activity of my Android application. However, the background is blue. I would like it to be the gray gradient that toolbars generally are. How can I achieve this?

Here is the XML of my toolbar. It places a checkbox on the left side and some text in the center.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    style="?android:attr/windowTitleBackgroundStyle"
    android:layout_height="?android:attr/windowTitleSize"
    >
    <CheckBox
  android:id="@+id/inbox_selectall"
  android:text=""
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:gravity="center_vertical"
  android:focusable="false"
  android:background="@drawable/checkbox_background"
  android:button="@drawable/checkbox"
  android:paddingLeft="6dip"
 />
 <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_centerVertical="true">
  <TextView
   xmlns:android="http://schemas.android.com/apk/res/android"
   style="?android:attr/windowTitleStyle"
     android:id="@+id/myTitle"
     android:text="@string/inbox"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:gravity="center_vertical|center_horizontal"
     android:background="@null"
         android:fadingEdge="horizontal"
         android:scrollHorizontally="true"
 />
 </LinearLayout>
</RelativeLayout>

Thanks for your help

A: 

I see my problem. This should work, but I had a style with a blue background set on the Activity tag of the manifest.

Andrew