Search code examples
androidheaderactionbarsherlock

SherlockActionBar getting space from left side of logo


I am trying to set logo of action-bar at run-time as shown in below image and hide back arrow but getting space in left side of action-bar(worked fine in 2.3 but not in 4.0).

How to remove this space? And also I want to remove logo and action-bar menu click glow effect? enter image description here

private void actionbarsetUp() {
            Drawable d = getResources().getDrawable(R.drawable.header_background);
            getSupportActionBar().setBackgroundDrawable(d);
            getSupportActionBar().setLogo(R.drawable.header_sidebar_btn);
            getSupportActionBar().setDisplayShowTitleEnabled(false);
            getSupportActionBar().setDisplayHomeAsUpEnabled(false);
            getSupportActionBar().setHomeButtonEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);

            LayoutInflater inflator = (LayoutInflater) this
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View v = inflator.inflate(R.layout.actionbar_title, null);
            ImageView imgName = (ImageView) v.findViewById(R.id.action_txt_name);
            getSupportActionBar().setCustomView(v);
            getSupportActionBar().setDisplayShowCustomEnabled(true);

        }

Solution

  • just change getSupportActionBar().setDisplayShowHomeEnabled(false); and remove space.