Action bar being shown below its tabs

前端 未结 3 1539
隐瞒了意图╮
隐瞒了意图╮ 2021-01-18 23:33

When i set these attributes:

    actionBar = getSupportActionBar();

    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(f         


        
3条回答
  •  长发绾君心
    2021-01-18 23:46

    All post above collapsing the home icon but leaving a blank space. For avoiding that you need to set the logo size to zero . Below added my code snippet.it may help for others who struggle with same problem.thanks

           actionBar.setLogo(new ColorDrawable(Color.TRANSPARENT));
    
          View homeIcon = findViewById(
                    Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? 
                    android.R.id.home : R.id.abs__home);
            ((View) homeIcon.getParent()).setLayoutParams(new LayoutParams(0, 0));
            ((View) homeIcon).setVisibility(View.GONE);
    

提交回复
热议问题