ActionBarSherlock - Tabs appearing ABOVE actionbar with custom view

前端 未结 7 1892
春和景丽
春和景丽 2020-12-13 14:33

I Am trying to create an actionbar without the app logo/text, and with a centralised picture, and i know it is possible with a custom view, here is my code:

         


        
7条回答
  •  长情又很酷
    2020-12-13 15:16

    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 LinearLayout.LayoutParams(0, 0));
            ((View) homeIcon).setVisibility(View.GONE);
    

提交回复
热议问题