将图标与工具栏图标对齐 – Android材质设计

在新的材料设计(使用AppCompat)中,我试图将一些动作图标与新工具栏的抽屉图标对齐.就像是:

我想我正在正确地查看所有指标…

Touch Target Size

问题是我不能完全对齐,因为在左边的16px的填充之后,图标应该开始,但图标本身也有一些“padding”(从材质github的图标),如:

也许是愚蠢的,但我不知道我失踪了什么.如何考虑图像内的填充以正确对齐?对齐单选按钮或复选框与该动作栏图标相同的问题.

我试过这段代码

<RelativeLayout
    android:id="@+id/image_button"
    android:layout_width="72dp"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_width="32dp"
        android:layout_height="48dp"
        android:layout_marginLeft="16dp"
        android:layout_marginStart="16dp"
        android:src="@drawable/ic_label_grey600_48dp" />
</RelativeLayout>

但是看起来不像我的贴图(就像我发贴的第一个截图).这里也看起来完美对齐:

而且,看起来像是在占用一些超过72px和16px的填充量的东西.

UPDATE

好的,让我向你们展示更多的例子和一些代码.成像我的列表项具有带有标签文本的单选按钮.

<RadioButton
     style="?android:textAppearanceMedium"
     android:layout_width="wrap_content"
     android:layout_height="48dp"
     android:layout_marginLeft="16dp"
     android:paddingLeft="32dp"
     android:singleLine="true"/>

结果:

我实际上并没有看到一个规则,将marginLeft和paddingLeft设置为正确的值,而不使用自定义按钮作为单选按钮(并且知道该按钮的尺寸)…< - 哪个是不好的选项,因为颜色按钮是从我的accentColor(材料的新材料)中取出的. 新的Gmail应用程序看起来还会面临一些对齐问题(请参阅何时选择邮件,1未与邮件标题对齐):

解决方法

The problem is that I can’t perfectly align it,because after that
left padding of 16px,the icons should start,but the icon itself has
also some “padding” (icon from material github)

是的,图标必须有一些填充,并且取决于图标将显示哪个屏幕分辨率而有所不同.
不同屏幕密度的填充:

mdpi 4px * 1.0 = 4px

hdpi 4px * 1.5 = 6px

xhdpi 4px * 2.0 = 8px

xxhdpi 4px * 3.0 = 12px

xxxhdpi 4px * 4.0 = 16px

这是可绘制图标中包含的填充,您不应该删除它.

http://www.google.com/design/spec/style/icons.html#icons-system-icons

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...