我有以下主布局代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/layout"
android:gravity="center"
android:background="#00000000"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#FFFFFF" />
</LinearLayout>
我需要 LinearLayout 是透明的。我认为我可以使用背景属性中的 alpha 设置来做到这一点,但它不起作用。请告诉我 - 我需要我的应用程序是空的,并且在屏幕中央有一个白色矩形。
最佳答案
您希望 Activity 透明吗?
尝试在您的 Activity 标签中使用此主题(在 list 文件中):@android:style/Theme.Translucent
对于其他可能的方式,即子主题,请参见以下答案:
Activity should be transparent, but has black background
关于java - 如何制作透明布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9663916/