Skip to content Skip to sidebar Skip to footer

Android Gradient Application Title Bar

Possible Duplicate: How do I programmatically set the background color gradient on a Custom Title Bar? I want to use gradient color in application title bar. How can I do it? Th

Solution 1:

All people are trying to use Custom title for this requirement.

I achieved this without using custom title. Just use below code in your activity's onCreate() after setContentView().

GradientDrawablegd=newGradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, newint[] {Color.RED,Color.GREEN});
Viewtitle= getWindow().findViewById(android.R.id.title);
ViewtitleBar= (View) title.getParent();
titleBar.setBackgroundDrawable(gd);

Enjoy with above code. Below image is screen shot of my app with gradient color as title bar background.

Gradient Color as Background of title bar

Post a Comment for "Android Gradient Application Title Bar"