新的浮动操作按钮应为56dp x 56dp,其内部的图标应为24dp x 24dp。因此,图标和按钮之间的间距应为16dp。
<ImageButton
android:id="@+id/fab_add"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="bottom|right"
android:layout_marginBottom="16dp"
android:layout_marginRight="16dp"
android:background="@drawable/ripple_oval"
android:elevation="8dp"
android:src="@drawable/ic_add_black_48dp" />
波纹_oval.xml
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item>
<shape android:shape="oval">
<solid android:color="?android:colorAccent" />
</shape>
</item>
</ripple>
这就是我得到的结果:
我使用了\ material-design-icons-1.0.0 \ content \ drawable-hdpi \ ic_add_black_48dp.png https://github.com/google/material-design-icons/releases中的图标
/标记/1.0.1
如何使按钮内的图标大小完全符合准则中所述?
http://www.google.com/design/spec/components/buttons.html#buttons-floating-action-button
由于您的内容是24dp x 24dp,因此您应该使用24dp图标。然后android:scaleType="center"
在您的ImageButton中设置以避免自动调整大小。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句