ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

android – 减少工具栏上导航图标和徽标之间的填充

2019-07-13 04:25:49  阅读:246  来源: 互联网

标签:android padding icons navigation-drawer toolbar


有谁知道如何减少工具栏上的导航图标和徽标之间的填充.由于某种原因,它们之间似乎有更多的空间,然后在我的徽标和标题之间.

我已经尝试添加样式并使用contentInset但它们似乎都不起作用.

我的布局

<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/background_grey"
android:style="@style/ToolbarTheme"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:logo="@drawable/ic_launcher">

</android.support.v7.widget.Toolbar>

我的风格

<style name="ToolbarTheme" parent="Theme.AppCompat">
    <item name="android:minWidth">0dip</item>
    <item name="android:paddingLeft">0dip</item>
    <item name="android:paddingRight">0dip</item>
</style>

Image (Space indicated by red lines should be smaller)

解决方法:

如果您只对缩小工具栏上导航图标和徽标之间的填充感兴趣,请使用
Toolbar.setContentInsetStartWithNavigation(0)

Unlike contentInsetStart, this will modify the inset only when there
is a Navigation Icon. In the absence of the Navigation Icon, you will
still have the 16dp start inset.

标签:android,padding,icons,navigation-drawer,toolbar
来源: https://codeday.me/bug/20190713/1446038.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有