我已经编写了一个对话框的程序,当单击图像按钮时弹出该对话框,但不幸的是它的标题背景是黑色的,我无法改变它的颜色,我的文本对话框上方的部分,我将发布一个我的对话框的快照,请需要一些帮助
@Override
public void onClick(View v) {
PopupMenu popup = new PopupMenu(wrapper, v);
popup.getMenuInflater().inflate(R.menu.home, popup.getMenu());
popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
android.app.FragmentManager manager = getFragmentManager();
final MenuDialog dialog = new MenuDialog();
dialog.show(manager, "About App");
return true;
}
});
popup.show();
}
});
答案 0 :(得分:1)
您可以使用代码
final Dialog mailDialog = new Dialog(MainActivity.this);
mailDialog.getWindow().setBackgroundDrawableResource(R.drawable.dialog_box);
<强> dialog_box.xml 强>
<?xml version="1.0" encoding="utf-8"?>
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp" />
<gradient
android:angle="-90"
android:centerColor="#660D1E4A"
android:endColor="#66011444"
android:startColor="#66505E7F"
android:type="linear"
/>
<stroke
android:dashGap="0dp"
android:dashWidth="0dp"
android:width="1dp"
android:color="#ffffffff" />
这是一个自定义对话框,您可以添加所需的属性。希望这会有所帮助