gpt4 book ai didi

android - 如何去除对话框外的透明深色背景

转载 作者:可可西里 更新时间:2023-11-01 18:49:29 53 4
gpt4 key购买 nike

我想删除对话框外的透明深色背景。

enter image description here

我试过:

final Dialog dialog = new Dialog(this);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE));
this.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE));
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.spinner_layout);
getWindow().getDecorView().setBackgroundResource(android.R.color.transparent);

最佳答案

除了chuky的回答;

如果您的 minSdkVersion 值大于或等于 14,则可以使用 setDimAmount() 方法。

dialog.getWindow().setDimAmount(float amount);

根据 reference ;

amount 新的暗淡量,从 0(无暗淡)到 1(全暗淡)。

As stated previously,您可以清除窗口标志。

关于android - 如何去除对话框外的透明深色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21477484/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com