android - 如何在 Activity 中使背景图像透明?

标签 android eclipse

我想使用具有普通 View 和控件的 Activity

我把它的背景做成图片了,我不能把这个图片做成透明的 这是我的代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/honey"
 >
</RelativeLayout>

我只想让图像透明

最佳答案

试试这个透明背景:

在AndroidManifest.xml文件中

<activity android:name="YourActivity" android:theme="@style/TransparentStyle"></activity>

在文件/res/values/style.xml 中

<resources>
  <style name="TransparentStyle">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
    <item name ="android:windowBackground">#00000000</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:colorForeground">#ffffff</item>
  </style>
</resources>

然后尝试使用透明图像:

<ImageView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:src="@drawable/yourImage"
  android:alpha=".75"/>

关于android - 如何在 Activity 中使背景图像透明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24024646/

相关文章:

android - Android上的百度 map : access key does not work for location searching

eclipse - 在 Eclipse SWT/JFace 中具有自动完成功能的 TextCellEditor?

java - Ubuntu 上的 Eclipse : Web Deployment Assembly only copy folders without content

java - 如何使用 Eclipse "Export as jar option"和属性文件构建 jar

python - "from . import views": Unresolved import

android - 无意中调用了 Realm 更改监听器

android - 我可以在 Android 应用程序中嵌入自定义字体吗?

android - 在构建应用程序期间在 Eclipse 上导入文件时出现问题

java - 读取并显示传入的消息文本android

android - Firebase 远程配置安全