4
我创建了一个具有圆角的背景图像的自定义对话框。我删除使用自定义样式的白色边框,但是如果同样大小的黑色矩形背后我的形象,它的显示,如下图所示(对话框的背景图像是棕色的):问题与Android中的透明背景图像
如何保持图像的透明背景与圆角?
布局我的对话框:
<style
name="Theme_Dialog_Translucent"
parent="android:Theme.Dialog">
<item name="android:windowBackground">@null</item>
</style>
我CustomDialog类是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/confirmation"
android:orientation="vertical"
android:background="@drawable/dialog_background"
android:layout_width="279dp"
android:layout_height="130dp"
>
...
我通过应用以下样式到我的对话框中删除的白色边框
public class CustomDialog extends Dialog implements OnClickListener {
Button okButton;
public CustomDialog(Context context) {
// Custom style to remove dialog border - corners black though :(
super(context, R.style.Theme_Dialog_Translucent);
// 'Window.FEATURE_NO_TITLE' - Used to hide the title
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.custom_dialog);
okButton = (Button) findViewById(R.id.button_ok);
okButton.setOnClickListener(this);
}
...
}
是的,它确实解决了问题!谢谢。我不能直接设置十六进制值,我必须将它设置为- @ color/transparent
,并创建一个color.xml文件,其中包含 #00000000 。 –
jul
2011-02-18 13:47:40