Saturday 5 April 2014

Android change Background color on Action Bar

1. Add Action Bar to your project.

2. Open the ActivityMain.java file and add the below imports to the imports section.

    import android.app.ActionBar;
    import android.graphics.drawable.ColorDrawable;

3. Then, in the ActivityMain.java file add the below to the onCreate method.

           ActionBar ab = getActionBar(); 
ColorDrawable colorDrawable = new ColorDrawable(Color.parseColor("#81a3d0"));     
          ab.setBackgroundDrawable(colorDrawable);

4. Determine the Hex color you would like and update the Color.parColor above to your specific color.

No comments:

Post a Comment