Thursday, 28 July 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);

}
}


No comments:

Post a Comment