android - 我想把图片放在按钮上

标签 android eclipse android-layout android-xml android-button

我想把 png 图像放在按钮上我试过 android:background 但是 png 占据了所有按钮我想要的是像这样在按钮上使用 Logo png

enter image description here

信息 Logo 是我的 png,“关于”来自按钮文本

最佳答案

你可以使用这个:

android:drawableTop="@drawable/SomeIcon"

然后你得到这个:

<Button
android:id="@+id/damage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="about"
android:drawableTop="@android:drawable/ic_menu_info_details"/>

enter image description here

对我有用:)

关于android - 我想把图片放在按钮上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26773668/

相关文章:

java - Opencv HSV颜色范围选取问题

android - 如何在不从源代码创建新项目的情况下将 Android 项目导入到 Eclipse 中?

android - 依赖=[com.google.android.gms :google-play-services:apklib:7:compile] not found in workspace

android - 通过 Glide 播放视频

java - 当我打开任何 Android 应用程序时,如何显示我的布局(xml 文件)?

android - VenueController.selectSpace 不高亮 Space

java - 如何在 Lotus Notes 8.5+ 中向电子邮件消息窗口工具栏添加按钮?

Android 线性渐变绘制

Android WebView 屏幕在加载下一页或同一页时变黑

安卓.view.InflateException : Binary XML file line #17: Error inflating class <unknown>