Sunday, January 26, 2014

Android activity title background color/image change


For changing Title bar background, add the following code in the activite's onCreate() function,

 ActionBar bar = getActionBar();
//for color
 //bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#DDAAD")));
//for image
 bar.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_bg3));
bar.setTitle("add your own title here");

For changing the Title bar title's color,

In the onCreate() Function,

this.setTitleColor(getResources().getColor(R.color.black));

No comments:

Post a Comment