是否有可能使一个按钮的背景透明? [英] Is it possible to make the background of a button transparent?

查看:125
本文介绍了是否有可能使一个按钮的背景透明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮,像这样......

如果它看起来暗,但你可以看到,我已经设置了高度和宽度来包装内容,但scaletype不fitxy所以还有,如果你会的。

是按钮过剩

对不起

有什么办法去除呢?


解决方案

使用的ImageButton 并设置它为透明这样的背景:机器人:背景=@机器人:彩色/透明

 <的ImageButton
        机器人:ID =@ + ID / BTN。
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:背景=@机器人:彩色/透明
        机器人:SRC =@绘制/ btn_login/>

I have a button like so...

Sorry if it looks dark but as you can see, I have set the height and width to wrap content but the scaletype is not fitxy so there is still "button excess" if you will.

Is there any way to remove this?

解决方案

use an ImageButton and set the background of it to transparent like this : android:background="@android:color/transparent"

<ImageButton
        android:id="@+id/btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:src="@drawable/btn_login" />

这篇关于是否有可能使一个按钮的背景透明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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