如何进行透明视图。有人能帮助我吗?
我想这样做:
答案 0 :(得分:3)
创建一个布局,并在清单中将主题设为对话框
并在您的布局中将背景设置为android:background="#885A2720"
修改强> 在视图中检查此布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:minWidth="250dp"
android:minHeight="380dp"
android:layout_gravity="center_vertical|center_horizontal"
android:background="#885A2720" style="@android:style/Theme.Holo.Dialog">
</LinearLayout>
答案 1 :(得分:0)
您应该能够更改叠加层的不透明度/ alpha。
答案 2 :(得分:0)
如果您要使用relativeLayout,请使用高度和宽度为match_parent的imageView。 并将图像的 alpha 设置为150dp。
答案 3 :(得分:0)
使用drawables绘制矩形
要获得完全透明,请使用以下drawable
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="#00000000" />
<stroke android:width="0.3dip" android:color="#2f4f4f"
android:dashWidth="7dip"
android:dashGap="7dip"/>
</shape>
如果要设置%透明度,可以设置所用小部件的“Alpha”属性。请注意,其中没有任何内容的文本框可以帮助您实现这一目标。