Android: Custom action bar,How to use entire width?

前端 未结 5 910
梦如初夏
梦如初夏 2020-12-10 04:54

Here is an image of my custom action bar:

\"enter

I want to use the entire wid

5条回答
  •  再見小時候
    2020-12-10 05:42

    Read this link1, link2 and set the contentInsets to 0dp like done below:

    View mCustomView = mInflater.inflate(R.layout.actionbar_invoice, null);
    getSupportActionBar().setCustomView(mCustomView);
    Toolbar toolbar=(Toolbar)mCustomView.getParent();
    toolbar.setContentInsetsAbsolute(0,0);
    

    If you are using custom Toolbar instead of ActionBar then use below code:

    
    

    I Hope this might help you.

提交回复
热议问题