从android导航抽屉图标中删除左边距

问题描述:

有人可以帮助我找到删除导航抽屉图标左边缘的方法(由下面的红色矩形表示)吗? 我在这里使用工具栏.

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.

这会从工具栏中删除左侧边距.

This removes the left margin from toolbar.

mainToolbar.setContentInsetsAbsolute(0, 0);

或者您可以在工具栏xml中将左插图设置为0dp:

Or you can set left inset to 0dp in toolbar xml:

android:contentInsetLeft="0dp"

其他方法是在styles.xml中定义该填充:

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..