【发布时间】:2015-11-03 04:40:03
【问题描述】:
每次我将图像添加到我的按钮(想将其添加到文本下方)时,它只会显示图像的左上角,并且即使我使用 android:drawableBottom 。
这是我的 XML 代码:
<Button
android:layout_width="162dp"
android:layout_height="200dp"
android:text="@string/weather_station"
android:textStyle="bold"
android:textSize="18dp"
android:background="@drawable/weather"
android:paddingBottom="120dp"
android:paddingLeft="5dp"
android:typeface="monospace"
android:id="@+id/weather_station" />
android:drawableBottom="@drawable/weatherman"
/>
【问题讨论】:
-
为什么不使用一个ViewGroup(如垂直LinearLayout)来代替Button,并把ImageView和TextView作为children,然后给ViewGroup设置一个onClickListener?
-
用textview代替button,然后可以设置drawable bottom
-
我使用了按钮,它对其中一个有效,然后我尝试了另一个,但我仍然有同样的错误。实际上我在页面上制作了 4 个按钮
标签: android android-layout android-activity android-button