markdowneide 于 2013.02.05 15:25 提问
- 如何创建一个透明的 ImageButton?
-
我想创建一个透明的 ImageButton,把这些按钮都放在一个 SurfaceView 视图中,我在XML中这样设置的代码:
<ImageButton android:id="@+id/previous" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/media_skip_backward" android:background="@drawable/transparent"> </ImageButton>
但是这样透明的 ImageButton 没有创建成功,如何实现呀?
-
- clcurie_11 2013.02.06 11:39
- 已采纳
给个具体的方法:
<ImageButton
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/media_skip_backward" >
</ImageButton>
-
- sasuke38 2013.02.06 10:12
src中的内容会覆盖在background内容之上 不过ImageButton里面包含的东西比较多 你可以只用Button或者一个View不就好了 反正都能添加onclick事件
-
- baimy1985 2013.02.05 15:52
android:background="#ff000000"
你的背景色设成这样试试,看看是不是你想要的效果
-
- Jave_ 2013.02.05 17:05
android:background="#00000000"
-
- zlQQhs 2013.02.25 23:56
ImageButton imb = (ImageButton) findViewById(R.id.imageButton1);
imb.setAlpha(50);
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!