The application icon does not show on action bar

前端 未结 6 1815
暗喜
暗喜 2020-11-29 02:06

I followed up the instructions of building a new android project and I got a runnable one except a problem with action bar. The problem is that the application icon is not s

6条回答
  •  天涯浪人
    2020-11-29 02:32

    Make sure you have the icon set in the manifest.xml file, in the application tag as:

        android:icon="@drawable/launcher_icon"
    

    Then in the onCreate method insert the following lines:

        ActionBar ab =getSupportActionBar(); 
        ab.setDisplayShowHomeEnabled(true);
        ab.setIcon(R.drawable.launcher_icon);
    

提交回复
热议问题