In my Android application, I hid the default title bar, introduced TabView, and added my own title under the TabView tabs. At the moment I am using the android: attr / windowTitleStyle style, which makes my new title gray and gradient. It looks good, but my screens look pretty grayscale. I would like to tweak things a bit by making this title a different color gradient.
What am I watching here? Creating your own image and using it? Style? Android: attr / windowTitleStyle seems to expand depending on the height of your custom title; so I'm not sure if this is actually a single image.
I tried to execute LinearLayout on it with a bit of transparency (for example: creating color # 800000FF), but the gradient style that I have behind this LinearLayout disappears.
thanks for the help
Update:
In my answer below, I realized that I can create an XML file that defines the gradient and use it. It works fine inside the LinearLayout (titlebar_gradient), which I have on my layout. However, it does not work with external LinearLayout (background_gradient). Can someone tell me why? As I understand it, ListView should be transparent ...
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background_gradient" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="47dip" android:background="@drawable/titlebar_gradient" android:gravity="center"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="Item" style="?android:attr/windowTitleStyle" android:paddingLeft="5dip" android:maxLines="1" android:ellipsize="end" /> </LinearLayout> <ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="10dip" android:clickable="false" /> <TextView android:id="@+id/android:empty" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>
android gradient titlebar android-titlebar
Andrew
source share