【发布时间】:2011-07-06 13:46:43
【问题描述】:
我正在为 Android 编写一个应用程序。
在定义布局的 xml 文件中,我有一个带有 6 个选项卡的 TabHost,它们都有相同的大背景图像“settingsdlg.gif”。
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/settingsdlg" >
..
在styles.xml中我指定窗口必须是透明的:
<resources>
<style name="my_app_style" parent="@android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
问题是背景图像“settingsdlg.gif”是一个圆角矩形,边缘的小区域应该是透明的,是绿色的。
我知道要在Android上的图像中使用透明度,图像必须是PNG格式,我想要透明的像素应该保存为透明的PNG。
不幸的是,我从数据库中获取图像,但无法更改它们,因为它们也用于 Win32 和 Mac 的其他应用程序中。
有没有办法告诉 Android 背景图像中的绿色像素应该是透明的?
谢谢!
【问题讨论】:
标签: android image background replace transparent