Phe*_*ix7 2 transparency android background-image
嗨我需要在活动中放置一个背景图像,这个图像需要有点透明,因为我想把文字放在它上面.如何才能做到这一点?可以直接在xml文件上完成,如果是,如何?它是否也可以以编程方式进行,如果是,如何?你能告诉我一个例子吗?谢谢!
Dan*_*Gar 13
XML示例如下所示
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/myimage"
android:alpha=".75"/>
Run Code Online (Sandbox Code Playgroud)
以编程方式,您也可以设置它
int alphaAmount = 125; // some value 0-255 where 0 is fully transparent and 255 is fully opaque
myImage.setAlpha(alphaAmount);
Run Code Online (Sandbox Code Playgroud)
其中myImage是一个ImageView.
| 归档时间: |
|
| 查看次数: |
18108 次 |
| 最近记录: |