繁体   English   中英

按钮中图标和文本之间的距离

[英]Distance between icon and text in the Button

我在XML中定义了一个按钮,如下所示:

<Button
    android:layout_width="@dimen/logo_menu_width"
    android:layout_height="@dimen/logo_menu_height"
    android:layout_margin="@dimen/logo_menu_margins"
    android:gravity="left|center_vertical"
    android:background="@drawable/selector_blue"
    android:drawableStart="@drawable/ic_action_settings"
    android:paddingStart="6dp"
    android:text="Options"
    android:textColor="@color/blue_light"
    android:textSize="@dimen/logo_menu_text"
    android:id="@+id/buttonOptions"
    android:layout_gravity="center_horizontal" />

如何增加图标(使用drawableStart设置)和文本之间的距离? 文本对齐方式设置为左侧。 paddingStart设置为6dp,但它仅适用于图标,而不适用于文本。

是否可以使用XML文件进行设置?

我知道我可以使用LinearLayout来实现这一点 - 包含ImageView和TextView,但我试图限制视图的嵌套。

使用android:drawablePadding属性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM