Customize Actionbar and remove left margin

Source: Internet
Author: User

By customizing the Actionbar layout to change the style of the Actionbar, simple and beautiful, but there is a detail must be noted in the high resolution left blank problem, generally in the resolution of more than 720 next found no matter how you change the layout file there will always be a small blank

public void setactionbarlayout (int layoutid) {ActionBar ActionBar = Getactionbar (); if (null! = ActionBar) {//Remove blank Actionba R.settitle (""); actionbar.setdisplayshowhomeenabled (false); actionbar.setdisplayshowcustomenabled (true); Layoutinflater inflator = (layoutinflater) this.getsystemservice (Context.layout_inflater_service); View v = inflator.inflate (LayoutID, NULL); Actionbar.layoutparams layout = new Actionbar.layoutparams (layoutparams.match_parent, layoutparams.match_parent); Actionbar.setcustomview (v, layout);}
Then call and pass in the layout at the appropriate location
Setactionbarlayout (R.layout.item_setting_actionbar);


Customize Actionbar and remove left margin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.