给activity标题栏添加图标

设置在左边的图标

   getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
        setContentView(R.layout.main);
        getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.pic1);

给activity标题栏添加图标

设置在右边的图标

   getWindow().requestFeature(Window.FEATURE_RIGHT_ICON);
        setContentView(R.layout.main);
        getWindow().setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON, R.drawable.pic1);

给activity标题栏添加图标

 

注意:getWindow().requestFeature(Window.FEATURE_LEFT_ICON);必须要在setContentView前面使用

     

上一篇:android中获得系统语言


下一篇:Android mainfest文件 android属性 汇总 (转)