安卓图像按钮 [英] android image button

查看:38
本文介绍了安卓图像按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个没有文本的按钮和一个水平居中的图像?我不想使用 ImageButton 因为我想定义一个不同的背景图像

How can i create a button with no text and an image centered horizontally ? I don't want to use an ImageButton because I want to define a different backgound image

推荐答案

您只需使用 ImageButton 并根据需要制作背景并将图标设置为 src.

You just use an ImageButton and make the background whatever you want and set the icon as the src.

<ImageButton
    android:id="@+id/ImageButton01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/album_icon"
    android:background="@drawable/round_button" />

这篇关于安卓图像按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆