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
Playing an Arbitrary Tone With Android
Error:(1, 0) Plugin With Id 'Com.Android.Application' Not Found
Android Create Shortcuts on the Home Screen
Tileprovider Using Local Tiles
How to Develop a Soft Keyboard For Android
How to Change Font Face of Webview in Android
How to Get Uri from an Asset File
How to Add a Jar in External Libraries in Android Studio
Determine If Android App Is Being Used For the First Time
Java.Lang.Runtimeexception: Unable to Instantiate Activity Componentinfo
How to Enable Logcat/Console in Eclipse For Android
Error Inflating Class Fragment
Can Not Find a View With Findviewbyid()