Customizes the actionbar and removes the left blank. customizes the actionbar.
You can customize the actionbar layout to change the actionbar style, which is simple, convenient, and elegant. However, you must note that there is a white space on the left under the high resolution, generally, at a resolution above 720, we can find that 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 the blank actionBar. 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 );}
Call and input the layout at the corresponding location
SetActionBarLayout (R. layout. item_setting_actionbar );