【发布时间】:2013-02-27 08:40:57
【问题描述】:
我创建了一个非常基本的布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button"
android:drawableStart="@drawable/ic_launcher" />
</LinearLayout>
</RelativeLayout>
根据the documentation for drawableStart,
“要绘制到文本开头的drawable。”
但是,在我的 Android 4.0.4 手机上运行时,我却看到了这个:
为什么图标和文字之间的差距这么大?根据this answer,
“使用 Android 4.0(API 级别 14),您可以使用 android:drawableStart 属性在文本开头放置一个可绘制对象。”
但这不是我观察到的行为。为什么属性不起作用?
【问题讨论】:
-
文档说这是在 api 17 中添加的
标签: android button drawable spacing