Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Black area is showing at left side in Action Bar Sherlock #1103

Open
williams-sgvu opened this issue Jun 20, 2014 · 1 comment
Open

Black area is showing at left side in Action Bar Sherlock #1103

williams-sgvu opened this issue Jun 20, 2014 · 1 comment

Comments

@williams-sgvu
Copy link

Hello I am using Sherlock library to achieve the ActionBar Tabs. Here I am setting custom title and want to hide the icon at the title bar but some issue that ActionBar tabs now appearing at above of ActionBar.

I see this issue here #327 (reference)

so I am trying to solve this issue using that working but that is creating other issue.

@OverRide
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tariff_plans_layout);

ActionBar actionBar = getSupportActionBar();

if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB) {
    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()).setVisibility(View.GONE);
    ((View) homeIcon).setVisibility(View.GONE);
}

actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);

View actionbar = LayoutInflater.from(this).inflate(R.layout.custom_title_bar, null);
getSupportActionBar().setCustomView(actionbar);
actionBar.setDisplayShowCustomEnabled(true);

}
but here now ActionBar title is looking like below, see there is left black area so I am looking to remove this with my color so my question Is there any way to remove that black area ?

custom_title_bar.xml

Below Android 3.0, I am having that issue but that is working perfectly above Android OS 3.0.

sn3pz

@arunantoney
Copy link

All workaround that 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

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);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants