Thursday, July 28, 2011

Set background color of title bar

Set background color of title bar

package com.exercise.AndroidTitleBar;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;

public class AndroidTitleBarActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        View title = getWindow().findViewById(android.R.id.title);
        View titleBar = (View) title.getParent();
        titleBar.setBackgroundColor(Color.CYAN);

    }
}


Updated: Set icon and background of ActionBar

2 comments:

Anonymous said...

not working u liar

Anonymous said...

Not working