How can I set SPACE between icon and toolbar title

I am trying to change the icon Toolbar

when I select item

, already do it and the fin is working, but the title and the Close icon are together as shown in the picture. I want to set space between them, any idea please?

enter image description here

   public boolean onNavigationItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.Fragment_art) {
        final String art = "<font color='#ffd159'>Art</font>";
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        getSupportActionBar().setIcon(R.mipmap.art);
        setTitle(Html.fromHtml(" Wallpapers : "+art));
    } else if (id == R.id.Fragment_Material) {
        final String Material = "<font color='#4acfd9'>Material</font>";
        setTitle(Html.fromHtml(" Wallpapers : "+Material));
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        getSupportActionBar().setIcon(R.mipmap.material);

    } else if (id == R.id.Fragment_Natural) {
        final String Natural = "<font color='#49a010'>Natural</font>";
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        getSupportActionBar().setIcon(R.mipmap.natural);
        setTitle(Html.fromHtml(" Wallpapers : "+Natural));
    } else if (id == R.id.Fragment_Animal) {
        final String Animal = "<font color='#e76541'>Animal</font>";
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        getSupportActionBar().setIcon(R.mipmap.animal);
        setTitle(Html.fromHtml("Wallpapers : "+Animal));
        }

      

+3


source to share


1 answer


Try to use



setTitle(Html.fromHtml("&nbsp;Wallpapers : "+art);

+4


source







All Articles