Answer the question
In order to leave comments, you need to log in
How to remove space on the left side of ActionBarSherlock (see screenshot)?
Appears on API version 21 (5.0.0) in API version 16 (4.1.1) everything is ok.
I use ActionBarSherlock 4.4.0, I prescribe a Custom View for the top bar, I don’t need all the other default elements:
activity.getActionBar().setHomeButtonEnabled(false); // disable the button
activity.getActionBar().setDisplayHomeAsUpEnabled(false); // remove the left caret
activity.getActionBar().setDisplayShowHomeEnabled(false); // remove the icon
activity.getActionBar().setCustomView(R.layout.action_bar_add_car);
activity.getActionBar().setDisplayShowCustomEnabled(true);
View homeIcon = activity.findViewById(android.R.id.home);
if (homeIcon != null) {
((View) homeIcon.getParent()).setLayoutParams(new LinearLayout.LayoutParams(0, 0));
((View) homeIcon).setVisibility(View.GONE);
}
Answer the question
In order to leave comments, you need to log in
Use AppCompat as written here https://github.com/JakeWharton/ActionBarSherlock
Try like this
View v = getActionBar().getCustomView();
LayoutParams lp = v.getLayoutParams();
lp.width = LayoutParams.MATCH_PARENT;
v.setLayoutParams(lp);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question