Custom icon in Android toolbar

后端 未结 4 1255
死守一世寂寞
死守一世寂寞 2020-12-30 05:30

I\'m trying to use define a custom icon in the support Toolbar but the only icon shown is a left arrow... I tried to set it in the layout and programmatically but the result

4条回答
  •  有刺的猬
    2020-12-30 06:25

    In case you want to change menu icon. (maybe somebody will need it)

    1. In your activity

      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.menu_info, menu);
          return true;
      }
      
    2. in your menu folder in res. (menu_info.xml)

      
      
          
      
      

提交回复
热议问题