Android API 21 Toolbar Padding

Android API 21 Toolbar Padding

The left inset is caused by Toolbar's contentInsetStart which by default is 16dp.

Change this to 72dp to align to the keyline.

Update for support library v24.0.0:

To match the Material Design spec there's an additional attribute contentInsetStartWithNavigation which by default is 16dp. Change this if you also have a navigation icon.

Unwanted Padding/Margin at the beginning of a custom toolbar

You need to add app:contentInsetStart="0dp" to your Toolbar if you want it to be flush with the starting (left in LTR) edge. There's also contentInsetEnd for the other side.

Material toolbar menu background padding and color

In order to remove this padding, change the android:popupBackground attribute of the popup menu style which is defined by actionOverflowMenuStyle attribute:

 <style name="defaultToolbarTheme" parent="Theme.MaterialComponents.NoActionBar">
...
<item name="actionOverflowMenuStyle">@style/OverflowMenuStyle</item>
</style>
<style name="OverflowMenuStyle" parent="Widget.MaterialComponents.PopupMenu.Overflow">
<item name="android:popupBackground">@null</item>
</style>

Another solution if that didn't work: to back to the style of the legacy PopupMenu overflow which doesn't add this padding by default:

<style name="OverflowMenuStyle" parent="Widget.AppCompat.PopupMenu.Overflow">
</style>

How to remove extra padding on top of toolbar in appbarlayout android

I suggest that try in you Activity

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}


Related Topics



Leave a reply



Submit