问题
Can anybody help me to find the way to remove the left margin of the navigation drawer icon (mentioned by red rectangle below )? I am using toolbar here.
回答1:
This removes the left margin from toolbar.
mainToolbar.setContentInsetsAbsolute(0, 0);
Or you can set left inset to 0dp in toolbar xml:
android:contentInsetLeft="0dp"
Other way is to define that padding in the styles.xml:
<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
<item name="contentInsetStart">0dp</item>
<item name="android:contentInsetStart">0dp</item>
</style>
If all of these solutions didn't worked please check if the image has its own padding..
来源:https://stackoverflow.com/questions/30301319/removing-left-margin-from-android-navigation-drawer-icon