I am learning android 3.0. Can any one tell How can add Image in Title bar in android 3.0? In developer site they are telling by default it will c开发者_开发知识库ome.but for me it is not coming. Thanks in advance.
You will have to create Custom Title Bar Layout to add your own image in titlebar.And then you can use following code to assign the titlebar to your view
boolean customTitleSupported;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
if (customTitleSupported) {
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.custom_tittlebar_layout);
}
setContentView(R.layout.main);
}
here custom_tittlebar_layout refers to your custom titlebar layout with image.
精彩评论