我想知道是否有人可以帮助我.我正在尝试创建自定义AlertDialog.为此,我在styles.xml中添加了以下代码行
<resources>
<style name="CustomAlertDialog" parent="android:Theme.Dialog.Alert">
<item name="android:windowBackground">@drawable/color_panel_background</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
以下是主要活动.
package com.customdialog;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
public class CustomDialog extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.setTheme(R.style.CustomAlertDialog);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("HELLO!");
builder .setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//MyActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int …Run Code Online (Sandbox Code Playgroud) 当我运行此代码时,会显示警告对话框,但对话框周围有一个白色边框,边框也很小.我不想要这个白色边框,我希望有90度角的真正角落.我希望你明白我想要做什么.
AlertDialog.Builder ad = new AlertDialog.Builder(this);
Button bbb=new Button(MvcnContactList.this);
ad.setView(bbb);
alertDialog = ad.create();
alertDialog.show();
Run Code Online (Sandbox Code Playgroud)

是否有任何方式来设置警报对话框,但不是文本颜色或文本大小或类似的东西...我想设置警报对话框的边框,所以设置一个主题可能是这个问题的解决方案.但我不知道要覆盖哪些属性.
谢谢,
编辑:例如这个样式覆盖textColor为00FF00,这很酷,但我应该覆盖哪个属性,使角落不圆,并删除那个白洞
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AlertDialogCustom" parent="@android:style/AlertDialog">
<item name="android:textColor">#00FF00</item>
<item name="android:typeface">monospace</item>
<item name="android:textSize">10sp</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud) 我想让我的Activity看起来像一个对话框,但没有标题栏.所以我想我应该自己写这个风格.
但是这种XML风格应该如何呢?
我已经为我的Activity尝试过Theme.Dialog,但问题是,我不想要Theme.Dialog风格的背景.没有屏幕标签.我有所有的屏幕构建由XML,我想只是在屏幕上居中,并有一个半透明的外部背景.
我有一个自定义警报对话框,我在其中设置列表视图,其背景为白色.
但我得到这样的观点.

这是适合整个屏幕的屏幕截图.
Dialog d = new Dialog(context,android.R.style.Theme_Translucent_NoTitleBar);
CustomDialogListAdapter customDialogAdapter;
ListView customList = new ListView(context);
customList.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
customList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
customDialogAdapter = new CustomDialogListAdapter(context,PaymentInfo.creditCardTypes, type);
customList.setAdapter(customDialogAdapter);
customList.setBackgroundColor(Color.WHITE);
d.setContentView(customList);
d.show();
Run Code Online (Sandbox Code Playgroud)
提前致谢..!