Archive

Archive for the ‘TitleBar’ Category

How to set icon for title bar in Android?

December 8, 2009 1 comment

In android we have the facility to set a icon for title bar.

see the below image here the title bar contains only title.
Title name is Iconic Memorey

How to set icon in title bar?.
use this.

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_RIGHT_ICON);
setContentView(R.layout.main);
setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON, R.drawable.icon);
}

By using this code we can get the output like below image

How to hide the title bar in Android?

December 8, 2009 Leave a comment

When we develop a game or some other application, we may need to show a full page(screen) for users.

See the below image, In that Alarm Clock is the title showing in title bar.

To remove this title bar we need to use,


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);
}

After this,

Now the title bar will be removed.