1

I have an Custom ActionBar in which i did not use Toolbar. At First i encountered that the width did not fill the whole screen (There were gap from both left and right side). but after reading this answer it solved my problem.

this is my code,

final ActionBar actionBar = getSupportActionBar();
View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
        ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
        actionBar.setCustomView(mCustomView, layoutParams);
        Toolbar parent = (Toolbar) mCustomView.getParent();
        parent.setContentInsetsAbsolute(0, 0);

Now this solution did work for phones though but for Tablets the same problem remains. please any help would be appreciated!!!!

Community
  • 1
  • 1
Proloy
  • 343
  • 1
  • 3
  • 14

0 Answers0