Tag: actionbar

[Q&A]How to center icon using customView in actionbar

1
2
3
4
5
6
7
ActionBar.LayoutParams layoutParams = 
new ActionBar.LayoutParams(
   ActionBar.LayoutParams.MATCH_PARENT,
   ActionBar.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.CENTER_HORIZONTAL|Gravity.CENTER_HORIZONTAL;
View customView = getLayoutInflater().inflate(R.layout.actionbar_custom_view, null);
actionBar.setCustomView(customView, layoutParams);
Tags :

[Q&A] tabs appearing ABOVE actionbar with custom view in NAVIGATION_MODE_TABS

1
2
3
4
5
6
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);
Tags :